Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!henry From: henry@utzoo.UUCP (Henry Spencer) Newsgroups: comp.lang.c Subject: Re: sizeof(((struct_type *)0)->member_name) Message-ID: <7418@utzoo.UUCP> Date: Tue, 16-Dec-86 15:44:50 EST Article-I.D.: utzoo.7418 Posted: Tue Dec 16 15:44:50 1986 Date-Received: Tue, 16-Dec-86 15:44:50 EST References: <351@danews.ATT.COM> <7373@utzoo.UUCP>, <737@dg_rtp.UUCP> Organization: U of Toronto Zoology Lines: 18 > >> Can I do something like this: > >> char a[sizeof(struct name *)0->element]; > > > Don't think so. > > Why not? Note what H&S have to say about sizeof, on page 153... > > Note that the evaluation of an indirection of the null pointer is indeed > illegal. But that isn't what is going on here... Hmmm... On thinking this over and consulting the Scriptures, I think Wayne is right and the construct is legal. It gives me the creeps, and I'd never use it, but I think it's legal. Recent X3J11 drafts are quite careful to say that certain operators must not be *evaluated* in constant expressions, rather than that they must not be present at all. -- Henry Spencer @ U of Toronto Zoology {allegra,ihnp4,decvax,pyramid}!utzoo!henry