TRUE and FALSE
Reino de Boer
reino at cs.eur.nl
Sat Sep 1 00:58:53 AEST 1990
volpe at underdog.crd.ge.com (Christopher R Volpe) writes:
>I wouldn't use TRUE and FALSE in comparisons such as if (x==TRUE)
>for the reasons Chris Torek outlined, but I think they are useful
>for setting default values, e.g. "int expert_mode = TRUE;".
>For tests, if you want the extra clarity, how about the following:
>#define TRUE(x) (x)
>#define FALSE(x) (!(x))
>and then do things like " if (FALSE((x==y) && (x==z)) || whatever) ..."
or, how about:
#define FALSE 0
#define TRUE 1
#define BOOL( b ) ( (b) ? TRUE : FALSE )
#define NOT( b ) BOOL( !(b) )
so that
NOT( TRUE ) == FALSE
holds.
-- Reino
--
Reino R. A. de Boer "We want to build the right product right, right?"
Erasmus University Rotterdam ( Informatica )
e-mail: reino at cs.eur.nl
More information about the Comp.lang.c
mailing list