On Wed, 07 Jul 2004 07:58:14 -0500 Eljay Love-Jensen <eljay@xxxxxxxxx> wrote: > Try this... > > ----------------------------------------------- > #include <stddef.h> /* stddef.h has offsetof macro. */ > > typedef unsigned short int u16_t; > typedef unsigned char u8_t; > > typedef struct > > struct { > u16_t ff1; > u16_t ff2; > u16_t ff3; > } f1[3]; > u8_t f2; > u8_t f3; > u8_t f4; > u16_t f5; > } Param_t; > > int main() > > size_t dist; > > dist = offsetof(Param_t, f1[0].ff1); > printf("f1[0].ff1 is at byte %lu\n", (unsigned long int)dist); > > dist = offsetof(Param_t, f1[2].ff2); > printf("f1[2].ff2 is at byte %lu\n", (unsigned long int)dist); > > dist = offsetof(Param_t, f3); > printf("f3 is at byte %lu\n", (unsigned long int)dist); > > > /* Output, using GCC 3.3.1 on Cygwin / WinNT > f1[0].ff1 is at byte 0 > f1[2].ff2 is at byte 14 > f3 is at byte 19 > */ I'm using gcc 3.3.2 cross compiler for renesas h8s micros, and it doesn't work. Inthe official gcc docs it seems that offsetof (and __builtin_offsetof) is supported in version 3.5.0. thanks -- Massimiliano Cialdi cialdi@xxxxxxxxxxx m.cialdi@xxxxxxxx