Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!husc6!mit-eddie!genrad!decvax!ittatc!dcdwest!sdcsvax!sdchem!tps From: tps@sdchem.UUCP (Tom Stockfisch) Newsgroups: comp.lang.c Subject: Re: sizeof(((struct_type *)0)->member_name) Message-ID: <605@sdchema.sdchem.UUCP> Date: Tue, 30-Dec-86 00:12:27 EST Article-I.D.: sdchema.605 Posted: Tue Dec 30 00:12:27 1986 Date-Received: Tue, 30-Dec-86 20:37:54 EST References: <351@danews.ATT.COM> <7373@utzoo.UUCP> <737@dg_rtp.UUCP> <7418@utzoo.UUCP> <312@hadron.UUCP> Sender: news@sdchem.UUCP Reply-To: tps@sdchemf.UUCP (Tom Stockfisch) Organization: UC San Diego Lines: 31 In article <312@hadron.UUCP> jsdy@hadron.UUCP (Joseph S. D. Yao) writes: >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. If this is legal, then the 4.3BSD C compiler is broken. The file below was sent to it, # define BLKSIZ 100 typedef int googol_t; /*###5 [cc] redeclaration of b%%%*/ /*###5 [cc] illegal indirection%%%*/ /*###5 [cc] warning: undeclared initializer name b%%%*/ struct { googol_t a; } b[BLKSIZ/sizeof(b[0])]; as well as the much simpler /*###1 [cc] redeclaration of a%%%*/ /*###1 [cc] illegal indirection%%%*/ /*###1 [cc] warning: undeclared initializer name a%%%*/ int a[ sizeof(a[0]) ]; Can the legality of this construct be deduced from K&R? Or is it an (obviously non-universal) extension? || Tom Stockfisch, UCSD Chemistry tps%chem@sdcsvax.UCSD