Boolean Operators Slighted in C

Arthur David Olson ado at elsie.UUCP
Wed May 7 08:40:14 AEST 1986


> The. . .header file that I mentioned a few days ago. . .
> contains the following:
>
> typedef int	bool;			/* boolean data */
> #define 	false	0
> #define 	true	1

My recommendation to folks would be to use the defines that appear in
the 4.?bsd version of "curses.h"--

	# define	TRUE	(1)
	# define	FALSE	(0)

--on a conditional basis in any "nifty_header.h" file, a la:

	#ifndef TRUE
	#define TRUE	(1)
	#define FALSE	(0)
	#endif

Using the "unnecessary" parentheses that appear in "curses.h" will prevent
any "redefined to a different value" diagnostics if you both
	#include "curses.h"
and
	#include "nifty_header.h"
while conditionalizing the definitions as above will prevent
"redefined (though not to a different value)" diagnostics if
you include both files in the order shown above.
--
	UUCP: ..decvax!seismo!elsie!ado		ARPA: elsie!ado at seismo.ARPA
	DEC, VAX, Elsie & Ado are Digital, Borden & Shakespeare trademarks.



More information about the Comp.lang.c mailing list