Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Help, page 197 K&R !!! Keywords: structures. Message-ID: <10480@smoke.BRL.MIL> Date: 2 Jul 89 03:21:43 GMT References: <646@kl-cs.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 32 In article <646@kl-cs.UUCP> atula@cs.keele.ac.uk (Atula Herath) writes: >"Two structures may share a common initial sequence of members; ..." >What does that mean ? This is explained in A8.3 in the second edition of K&R, which reflects the current state of C structure member name constraints. According to K&R 1st ed., structure member names for all structure types together constituted one big name space; however, that's not how C is currently defined -- now each structure type has a private name space for its members, so the same member name may be freely used in a variety of declarations of different structures. The cited quotation is simply not relevant under the current member name space rules. K&R 1st ed.: struct foo { int a; float b; }; struct bar { int a; /* legal */ char c; }; struct baz { double a; /* illegal */ int d; }; struct bam { float e; int a; /* illegal */ }; All the above are legal according to modern rules.