enum handling by cc under ultrix V2 wrong?

Michael Meissner meissner at osf.org
Sat Jun 30 07:31:20 AEST 1990


In article <1990Jun29.175209.16251 at watdragon.waterloo.edu>
tbray at watsol.waterloo.edu (Tim Bray) writes:

| Am porting a big application to a decsystem 3100 running ultrix V2.something;
| the cc compiler complains about the following things:
| 
| 1. The type 'void *' as a formal function parameter
| 2. The type 'void *' as a member of a union within a structure
| 3. Bitwise OR of enums (enum {e1, e2} foo; int set; set = e1 | e2;)
| 4. Bitwise AND of enums (enum {e1, e2} foo; int set; set = e1 & e2;)
| 5. enums as array indices (enum {e1, e2} foo; int x, y[3]; x = y[e1];)
| 
| These all seem like gross violations of both common sense and of the ANSI
| C standard as I read it in K&R V2.  In particular, there seems no excuse
| for the refusal to deal with enums as stated.
| 
| Questions:
| 
| 1. Am I insane, and the compiler correct?
| 2. Wil moving up to the most recent v3.whatever of ultrix correct this?
| 
| Apologies if this has been beaten to death here.  If so, flames by mail
| please.

The Ultrix based MIPS compilers are not completely ANSI.  Revision
1.31 in particular did not like void *.  My spies tell me, revision
2.00 of the compiler suite will fix these problems, but I suspect the
compiler has not been released in the V3 world, and is waiting for V4.

With regard to enums, disallowing enums in normal integer operations
without a cast was standard PCC (aka most UNIX systems) behavior.
Both the relaxation of enums to be plain ints, and void * are features
added in the ANSI standard, so older compilers may not yet support
these features.
--
Michael Meissner	email: meissner at osf.org		phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA

Do apple growers tell their kids money doesn't grow on bushes?



More information about the Comp.unix.ultrix mailing list