quote:
#define true 1
#define false 0
I'd recommend against that definition of true. True in C is non-zero, not necessarily one. A function that returns true might return 3 or 8 or 110 and still be compliant. Take this simple example.
#define true 1#define false 0main(){ int a = 5, b = 5; if(isEqual(a, b) == true){ printf("equal") }}int isEqual(int a, int b){ return a == b;}
In that program, the print statement won't print. isEqual will return 5*, which is not equal to 1. A better definition of true and false is:
#define false 0
#define true !false
EDIT --
* i should say might return 5. I guess that's really compiler dependant. The point is that compiler would be ANSI-C compliant if it did return 5.
[edited by - kdogg on May 20, 2004 9:41:23 PM]