Mail Archives: djgpp/1996/04/17/10:07:23
Reply to message 4728013 from KUKU AT GILBERTO on 04/17/96 3:37AM
>I didn't want to suggest sincerely using farse,tlue as variables
>in the program (that's why I used a smiley).
Oh, I know. It gave me a good laugh, too. :) But I still wanted to make
my point.
>When we are at judging
>about style I would state that defining a pair of boolean variables
>as an enum is bad style anyway since I'm not sure where is guaranteed
>that the compiler always chooses the value 0 for the first
>entry in the enum list - maybe it's defined in ANSI somewhere.
>At least I would consider it dangerous.
I think ANSI does specify that the first enumerated value is automatically
zero. But you are right in thinking that using enums can mask the actual
significance of the values. I can imagine some novice who depends too
much on enums doing something like "if ( (exp) == true )" and getting
creamed. :) In fact, the only real reason for using enums at all is for
preventing coding errors. A series of #defined constants usually works
just as well unless you are really concerned about debugging.
John
- Raw text -