Taking address of array
Doug Gwyn
gwyn at smoke.brl.mil
Sat Apr 13 07:56:09 AEST 1991
In article <12010 at dog.ee.lbl.gov> torek at elf.ee.lbl.gov (Chris Torek) writes:
> #define offsetof(s, e) ((int)((char *)&((s *)0)->e - (char *)0))
If you have access to some structure of the desired type, which should
always be the case when using such a macro, you could add an argument
to take the structure for the base address, rather than playing
nonportable games with casts of "0". The STD_C equivalent could
then just invoke offsetof() and ignore the extra structure argument.
More information about the Comp.lang.c
mailing list