Chromatic <[EMAIL PROTECTED]> wrote: [ align issues ]
Nested structs are ugly. The alignment of the first item seems to depend on the biggest item in the struct. struct { char // 0 struct { char // 1 } char // 2 } struct { char // 0 struct { char // 4 int // 8 } } So we need some notion of nested structs or a hint for correct alignment. I've checked in basic alignment handling for "normal" cases, but not the second one above. Below is a test program to experiment with that stuff. leo #include <stdlib.h> #include <stddef.h> #include <stdio.h> // offsetof expands to ((size_t) &(( struct xt *)0)-> x ) struct xt { char x; struct yt { char i; int j; // use different items here } _y; char z; } _x; int main(void) { printf("x : %d\n", offsetof(struct xt, x)); printf("i : %d\n", offsetof(struct xt, _y.i)); printf("j : %d\n", offsetof(struct xt, _y.j)); printf("z : %d\n", offsetof(struct xt, z)); return 0; }