Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!sdd.hp.com!spool.mu.edu!snorkelwacker.mit.edu!bloom-picayune.mit.edu!news From: jfc@athena.mit.edu (John F Carr) Newsgroups: comp.std.c Subject: offsetof Message-ID: <1991Mar6.232854.22267@athena.mit.edu> Date: 6 Mar 91 23:28:54 GMT Sender: news@athena.mit.edu (News system) Organization: Massachusetts Institute of Technology Lines: 18 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. The only compiler I've found that doesn't use some variant of #define offsetof(t,m) (size_t)&((struct t *)0)->m for offsetof does not allow offsetof(struct foo, a.b). Is it wrong? -- John Carr (jfc@athena.mit.edu)