3b-1 C language incompatibility?

a.v.reed avr at mtgzy.att.com
Wed Mar 15 03:21:12 AEST 1989


In article <4202ad64.c463 at apollo.COM>, aramini at 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 at mtgzy.ATT.COM)



More information about the Comp.sys.att mailing list