Cryptic C

FryPC pcf at drux3.UUCP
Wed Aug 21 05:27:24 AEST 1985


> Instead of using #defines for the boolean values, I
> would rather see enumerated data types used.  In general,
> C programmers seem to prefer #defines to defining a data
> type that can be checked during compilation.

>	 typedef enum { False , True } Boolean;

I have seen programs written with this style of declaration, they also
had lines such as:

	bool = (x<y) ? True : False;

	if( bool == True ) ...

		  which the enumerated type requires. I prefer defines
and
	bool = x<y; 	if( bool ) ...
	       to keep my programs both readable and correct.

(The enumerated type will also take more space (an int).)

Peter Fry
drux3!pcf



More information about the Comp.lang.c mailing list