Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!sri-spam!ames!ucbcad!ucbvax!decvax!decwrl!nsc!nsta!instable!amos From: amos@instable.UUCP Newsgroups: comp.lang.c Subject: Re: C struct definition according to K & R. Message-ID: <711@instable.UUCP> Date: Wed, 11-Mar-87 01:51:28 EST Article-I.D.: instable.711 Posted: Wed Mar 11 01:51:28 1987 Date-Received: Thu, 12-Mar-87 23:24:43 EST References: <9929@sri-spam.istc.sri.com> Reply-To: amos%nsta@nsc.com (Amos Shapir) Distribution: world Organization: National Semiconductor (Israel) Ltd. Lines: 30 In article <9929@sri-spam.istc.sri.com> robert@sri-spam.istc.sri.com (Robert Allen) writes: > My question to the net is, do you believe that the above constructs are > strictly legal in K&R C, or do you believe they are illegal in K&R C. > I'm interested in the C aspect, not so much how a given compiler does > it (although that would be much appreciated). The language described in K&R is that accepted by the PDP-11 v7 compiler, which is slightly different than that accepted by the now more common pcc compiler. The main difference is that for copatibility with the v6 compiler, which accepted a more primitive dialect of C that didn't have 'union' and 'enum', all struct members' names are pooled into a common name space. That makes the given example illegal in some compilers, though accepted as legal by the pcc compiler. Many ambiguities in K&R arise from the fact that it was written to describe one dialect, then, just before its publication, was converted to describe a slightly different dialect. > If you reply by mail or > on the net, please include the # of years you've been using C, and which > machines/compilers you use. Thanks! I have been working in C since 1977 on the PDP-11 v6 and v7, and have worked with the pcc (portable) compiler on the VAX, CCI6/32 for (which I did the adaption) and on NS32000 series micros. -- Amos Shapir National Semiconductor (Israel) 6 Maskit st. P.O.B. 3007, Herzlia 46104, Israel (011-972) 52-522261 amos%nsta@nsc.com 34.48'E 32.10'N