offsetof

Doug Gwyn gwyn at smoke.brl.mil
Mon Mar 11 05:57:14 AEST 1991


In article <1991Mar6.232854.22267 at athena.mit.edu> jfc at athena.mit.edu (John F Carr) writes:
>Is the following legal C?
>	struct foo { struct bar { int a;} b;};
>	offsetof(struct foo, a.b);
>Section 4.1.5 of the standard doesn't explicitly disallow this, but I wasn't
>able to find definitions elsewhere that would tell me if "a.b" is a
>structure member or not.

(1)  You mean "b.a", not "a.b".
(2)  You mean "designates", not "is".
(3)  The wording in the description of offsetof() was carefully chosen
to permit "dotted" member designators such as you attempted to use.



More information about the Comp.std.c mailing list