Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!sundc!hadron!jsdy
From: jsdy@hadron.UUCP (Joseph S. D. Yao)
Newsgroups: comp.lang.c
Subject: Re: sizeof(((struct_type *)0)->member_name)
Message-ID: <312@hadron.UUCP>
Date: Sun, 28-Dec-86 22:33:00 EST
Article-I.D.: hadron.312
Posted: Sun Dec 28 22:33:00 1986
Date-Received: Mon, 29-Dec-86 05:37:39 EST
References: <351@danews.ATT.COM> <7373@utzoo.UUCP> <737@dg_rtp.UUCP> <7418@utzoo.UUCP>
Reply-To: jsdy@hadron.UUCP (Joseph S. D. Yao)
Organization: Hadron, Inc., Fairfax, VA
Lines: 21
Summary: nit

In article <7418@utzoo.UUCP> henry@utzoo.UUCP (Henry Spencer) writes:
	[no attribution]
>> >> Can I do something like this:
>> >>     char a[sizeof(struct name *)0->element];

I hope someone said this while our news was down, but ... you may
not use tha above construct.  For precedence (and then also for
readability), the inner expression should be as in the Subject:
line:
	sizeof(((struct_type *)0)->member_name)

Some C compilers also haven't allowed arbitrarily complex or
semi-self-referential array size specifiers.  (The latter is,
e.g.:
	struct { googol_t a; } b[BLKSIZ/sizeof(b[0])];
.)  This is less of a problem these days, but may still be a
bug in some compilers.
-- 

	Joe Yao		hadron!jsdy@seismo.{CSS.GOV,ARPA,UUCP}
			jsdy@hadron.COM (not yet domainised)