NAME
boolean − simple TRUE/FALSE type for C/C++
SYNOPSIS
#include <codelibs/boolean.h>
typedef boolean int;
#define TRUE 1
#define FALSE 0
DESCRIPTION
This header file defines the type boolean and the values TRUE and FALSE. They may be safely used by C++ or C code. The boolean values of TRUE and FALSE are defined as macros rather enums since the return value from arithmetic test expressions is an “int” and not a special boolean value for both C and C++.
This boolean type is intended mostly for writing more readable, and hence more maintainable code.
EXAMPLES
#include <codelibs/boolean.h>
// standard readable routine to determine if an integer is ODD or EVEN
//
boolean is_odd(int val)
{
return (val & 0x01) ? TRUE : FALSE;
}
// typical C version, which also works as expected with type boolean:
//
boolean is_odd_too(int val)
{
return val & 0x01;
}
—