Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!columbia!caip!brl-adm!brl-smoke!smoke!rgenter@BBN-LABS-B.ARPA From: rgenter@BBN-LABS-B.ARPA (Rick Genter) Newsgroups: net.lang.c Subject: Re: Another bug in C compilers Message-ID: <2703@brl-smoke.ARPA> Date: Thu, 31-Jul-86 08:41:33 EDT Article-I.D.: brl-smok.2703 Posted: Thu Jul 31 08:41:33 1986 Date-Received: Fri, 1-Aug-86 03:23:36 EDT Sender: news@brl-smoke.ARPA Lines: 41 Accepting the declaration: struct ABC; is not a bug, it's a feature. This is termed a *vacuous declaration*, and permits the definition of cyclic recursive structures in an inner scope where one of the structures renames a structure from on outer scope. For example, struct ABC { int foo; double mumble; }; main () { struct ABC; struct DEF { char bar[ 128 ]; int bletch; struct ABC *foop; } a; struct ABC { double giant[ 5000 ]; struct DEF *barp; } b; } If you didn't have the vacuous declaration, the compiler would think that "foop" pointed at a structure consisting of "int foo" and "double mumble". Referencing foop->giant would get you "illegal structure pointer combination". -------- Rick Genter BBN Laboratories Inc. (617) 497-3848 10 Moulton St. 6/512 rgenter@labs-b.bbn.COM (Internet new) Cambridge, MA 02238 rgenter@bbn-labs-b.ARPA (Internet old) linus!rgenter%BBN-LABS-B.ARPA (UUCP) CHUBBY CHECKER just had a CHICKEN SANDWICH in downtown DULUTH!