Cryptic C (Actually typedef ? boolean;)

Doug Landauer landauer at drivax.UUCP
Wed Aug 21 05:08:04 AEST 1985


Doug Gwyn says:
> I am pretty conservative when it comes to defining one's own
> language extensions, this one seems like a winner:
> 
> 	typedef int	bool;
> 	#define	false	0
> 	#define	true	1

My favorite way to do this one is
	typedef enum { false, true } boolean ;

It provides a little more type checking than your typedef.
--
			-- Doug Landauer --
	...[ ihnp4 | mot | ucscc | amdahl ] !drivax!landauer
		-- "I survived the DRI layoffs." --
			-- "(So far!)" --



More information about the Comp.lang.c mailing list