C struct definition according to K & R.

amos at instable.UUCP amos at instable.UUCP
Wed Mar 11 16:51:28 AEST 1987


In article <9929 at sri-spam.istc.sri.com> robert at 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 at nsc.com 34.48'E 32.10'N



More information about the Comp.lang.c mailing list