more why I dont like C enums

utzoo!decvax!ittvax!sii!mem utzoo!decvax!ittvax!sii!mem
Sat Nov 6 23:14:28 AEST 1982

You are authorized to consider this comment to be picky.

The use of

  enum  BOOL { YES, NO };

may not work right; but to my mind (wherever that is), this usage
of enum isn't reasonable anyway, because it states that not only
do you know what values enum generates for its members (maybe
valid, maybe not, depending on your outlook... mine is to consider
enum members as valueless), but that you have to know what
values the compiler assumes for truth and falseness (also, maybe
valid, maybe not; at some point you have to know this, it is
mainly the matching of these two assumptions that makes this
one bad, again to my mind).  Granted, at some point you can't
get around knowing what the values for true and false are.
But I'd rather see them in #defines where you explicitly state
that you know what they are than declaring them to be
enumerated types.

Picky, picky.

Mark Mallett

More information about the Comp.lang.c mailing list