Boolean Operators Slighted in C

Frank Adams franka at mmintl.UUCP
Sat May 17 09:44:32 AEST 1986


In article <147 at daisy.warwick.UUCP> cudcv at daisy.warwick.ac.uk (Rob McMahon) writes:
>In article <412 at brl-smoke.ARPA> gwyn at brl.ARPA writes:
>>typedef int	bool;			/* boolean data */
>>#define 	false	0
>>#define 	true	1
>
>What about
>        typedef enum { false, true } bool;
>?

I will start using this when I can rely on having an ANSI standard compiler.
At the moment, there are too many compilers where the expression in an if
statement can't be an enum.  (Not to mention compilers which don't support
enums.)

Frank Adams                           ihnp4!philabs!pwa-b!mmintl!franka
Multimate International    52 Oakland Ave North    E. Hartford, CT 06108



More information about the Comp.lang.c mailing list