Grouse: What's the point of enum?

bryant eastham u-beasth%peruvian.utah.edu at cs.utah.edu
Fri Apr 19 02:47:58 AEST 1991


  Why ignore a construct that CAN give a clearer meaning to your programs?
Using an enum can:

   1) Allow a sequence of values to be assigned to identifiers
      without a bunch of #defines. (Not really a big benefit.)

   2) Allow the compiler to flag type violations on those constants. The
      other option would allow any integer to be passed, where using an
      enum can be checked. This is a considerable advantage.

  In general: Use what they give you to the best advantage!

  Bryant Eastham
  A programmer who cannot live without nested #includes OR enums.





More information about the Comp.lang.c mailing list