Enums

Dave P. Schaumann dave at cs.arizona.edu
Sat Jan 19 09:16:56 AEST 1991


In article <1991Jan17.211524.22679 at nntp-server.caltech.edu> manning at nntp-server.caltech.edu (Evan Marshall Manning) writes:
|dave at cs.arizona.edu (Dave P. Schaumann) writes:
|
||Is there really that many C compilers out there that don't have 'enum'?
|
|Yes.  Or have them wrong.
|
||I have heard arguments against using enum which go "it wasn't there when I
||started using C".  I trust such people do not use other advanced features of
||modern life, such as touch-tone phones, color TV, and the like.
|
|I started using C 4 years ago on a Sun & we had & used enums.  In my current
|project I started out using enums early & often.  The documentation of the
|target compiler claimed that enum was supported.  On first compile under
|PDOS I found that the compiler would forget about some enumerated constants
|after the end of the first function in a given file.  Out went the enums.
|
|Of course there will be an ANSI compiler for PDOS Real Soon Now....

I have difficulty in developing a code style based on broken compilers.  There
is another post on this thread which claims (paraphrased) "enums are difficult
to implement correctly".  I would think it would be just the opposite -- all
they are is global symbolic constants.  If I came across a compiler that didn't
do enums right, I'd wonder what else they got wrong.  I certainly wouldn't use
the -O (optimize) flag -- except maybe for a few laughs.

Hopefully, with the ever-spreading availability of gcc, such issues will soon
be of historical interest only.

||For my part, I believe that 'enum' is a powerful addition to C, and now it is
||part of the standard.  I use it unhesitatingly.
|
|Do use it, but not unhesitatingly.

Hacking around a compiler with broken enums should be the exception to coding
style, not the rule.

|Your eyes are weary from staring at the CRT for so | Evan M. Manning
|long.  You feel sleepy.  Notice how restful it is  |      is
|to watch the cursor blink.  Close your eyes.  The  |manning at gap.cco.caltech.edu
|opinions stated above are yours.  You cannot       | manning at mars.jpl.nasa.gov
|imagine why you ever felt otherwise.               | gleeper at tybalt.caltech.edu


Dave Schaumann		|  And then -- what then?  Then, future...
dave at cs.arizona.edu	|  		-Weather Report



More information about the Comp.lang.c mailing list