Next: , Previous: , Up: Top   [Contents][Index]


23 The "calib/logic.h" Header.

The "calib/logic.h" header contains macros that smooth out some of the C programming language’s sharp edges:

	#define NOT	!
	#define AND	&&
	#define OR	||
	#define EQ	==
	#define NE	!=

	#define FALSE	0
	#define TRUE	1

	#ifndef NULL
	 #define NULL	0
	#endif

For example, it is a common mistake to type = where == was intended. Many hours were wasted trying to find a bug whereing |= was typed instead of !=. The CALIB source code always uses EQ and NE instead, and doing likewise in your own coding conventions can save heartache. Similarly, it is common to accidentally type & instead of &&, and | instead of ||. Learning to always use AND, OR and NOT can similarly avoid such problems.