TRUE and FALSE (or true and false)
Stan Brown, Oak Road Systems
browns at iccgcc.decnet.ab.com
Fri Aug 31 05:00:25 AEST 1990
In article <26280 at mimsy.umd.edu>, chris at mimsy.umd.edu (Chris Torek) writes:
> Since this is all going around again (already!), it is probably time
> for a small addition to the FAQ list:
>
> Q: How about Booleans in C? For instance:
>
> typedef int bool;
> #define FALSE 0
> #define TRUE 1
>
> A: Some people believe this adds clarity. Beware, however:
>
> typedef enum { true, false } bool; /* bug */
>
[rest of excellent comments deleted]
Chris, I think adding this to the FAQ's is an excellent idea. I like the way
you said in your post that it's not settled whether int or enum is better for
this. Only suggestion I'd make: you tell how _not_ to write the enum; why not
also tell how to write it:
typedef enum {false, true} bool;
Stan Brown, Oak Road Systems, Cleveland, Ohio, U.S.A. (216) 371-0043
The opinions expressed are mine. Mine alone! Nobody else is responsible for
them or even endorses them--except my cat Dexter, and he signed the power of
attorney only under my threat to cut off his Cat Chow!
More information about the Comp.lang.c
mailing list