Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pasteur!ucbvax!tut.cis.ohio-state.edu!osu-cis!att!mtuxo!mtgzy!avr From: avr@mtgzy.att.com (a.v.reed) Newsgroups: comp.sys.att Subject: Re: 3b-1 C language incompatibility? Summary: Your code is bogus Keywords: 3b-1 C Message-ID: <4885@mtgzy.att.com> Date: 14 Mar 89 17:21:12 GMT References: <4202ad64.c463@apollo.COM> Distribution: usa Organization: AT&T, Middletown NJ Lines: 39 In article <4202ad64.c463@apollo.COM>, aramini@apollo.COM (Michael Aramini) writes: < The C declarations below are compilable by at least 3 different < C compilers, but the 3b-1's C compiler complains that I am trying < to redefine object. Is "object" a reserved word or predefined in < some other way in the 3b-1 C compiler? If thats not the problem, < does anyone have any suggestions about what else might be wrong? < < struct fixnum { < char type; < int count; < int fix_dat; < }; < struct symbol { < char type; < struct symbol *next; < char *pname; < union object *val; < union object *plist; < }; < struct cons { < char type; < int count; < struct object *car; < struct object *cdr; < }; < union object { < struct fixnum fix; < struct symbol sym; < struct cons cns; < char type; < }; In C, the identifiers of structs and unions share the struct-or-union identifier space. Code refering to both a struct and a union with the same identifier is bogus, and the results of trying to compile it are undefined. (In the future, could you please run your code through lint before publishing it on the net?) Adam Reed (avr@mtgzy.ATT.COM)