Take the following C structure:
typedef struct dataPoint {
tick * tickData;
struct dataPoint * previousDataPoint;
struct dataPoint * nextDataPoint;
} dataPoint;
Compiling on a 64-bit system with 8-byte words, this structure takes up 24 bytes (3 words) of memory.
24 % 8 = 0 ... so it is word aligned, yet for each structure created, it uses 4 words, why is this?
I am aware padding and alignment is done for performance reasons, but does anyone know the specific reason for this case, as it is already word aligned, perhaps CPU cache line boundaries?