What should be added to C (booleans)

Ken Arnold%CGL arnold at ucsfcgl.UUCP
Thu Jun 5 13:19:44 AEST 1986


In article <2176 at mit-eddie.MIT.EDU> Barry Margolin writes:
>I think your worries are unfounded.  The difference between (1 == 1) and
>1 is that the former indicates to human readers of the code that the
>expression is being used for its truth value.  In the statement
>	var = 1;
>the reader is likely to assume that var is going to be used
>arithmetically.

Actually, the *real* difference between "(1 == 1)" and "1" is that the
former causes lint to complain that a constant is being used in a
conditional context *every time you use it*.  This is no fun at all.  I
mean, really.

Isn't

	var = TRUE;

just as descriptive?  Why not do that, with

	# define	TRUE	1
	# define	FALSE	0

		Ken Arnold



More information about the Comp.lang.c mailing list