Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-crg!topaz!uwvax!husc6!harvard!panda!genrad!decvax!ittatc!dcdwest!sdcsvax!sdcc6!sdsioa!brunner From: brunner@sdsioa.UUCP (Rob Brunner X2830) Newsgroups: net.lang.c Subject: Re: Another bug in C compilers Message-ID: <161@sdsioa.UUCP> Date: Fri, 1-Aug-86 13:39:47 EDT Article-I.D.: sdsioa.161 Posted: Fri Aug 1 13:39:47 1986 Date-Received: Sat, 2-Aug-86 23:33:43 EDT References: <151@danews.UUCP> Distribution: net Organization: UC San Diego, Scripps Institution of Oceanography Lines: 42 > I believe I've found a bug in the C compiler for the Sys 5 Rel 2 3B20. > Say we have a structure declared as: > struct ABC > { > stuff > }; > and then follow it with: > struct ABC; > ... no error .... Which is equivalent to using: int ; as far as basic parsing is concerned. This is NOT A BUG, but a feature... If you look in K&R on pages 215,216 (in section 18.2-Declarations) you'll see essentially the following: declaration: decl-specs init-decl-list[opt] ; /* init-decl-list left out above */ ... /* this is the key... you normally */ /* use something like 'int k;' this */ /* allows 'int ;' */ decl-specs: type-spec decl-specs[opt] ; /* decl-specs left out above */ ... type-spec: ... struct-or-union-spec ... struct-or-union-spec: ... struct identifier ... Why this would ever be done is beyond me. Anyone have any applications of this (and want to admit it)? It might not be useful, but it is certainly legal. -- Rob Brunner email: Scripps Institution of Oceanography brunner@sdsioa.UUCP Mail Code A-010, UC San Diego sdsioa!brunner@sdcsvax San Diego, CA 92093 {backbone}!sdcsvax!sdsioa!brunner Phone: (619) 534-2040 (work) (619) 452-7656 (home)