Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!hsdndev!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: offsetof Message-ID: <15411@smoke.brl.mil> Date: 10 Mar 91 19:57:14 GMT References: <1991Mar6.232854.22267@athena.mit.edu> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 12 In article <1991Mar6.232854.22267@athena.mit.edu> jfc@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.