On Sat, Dec 17, 2011 at 1:12 PM, Raja Subramanian <[email protected]>wrote:
> Since C defines any non-zero value as true, rather than defining true as 1 > you better define true as !0. Ie, true is the opposite of false. > > This is the only way to ensure that a test against 2 true values will work > in all cases. > If you meant to say #define true !0 that is not going to work. Checking true against a variable with non-zero value will still fail. [ if(a == true) is same as if(a == !0) which will fail] C99 booleans automatically converts all values to one or zero according to standard rules before storing it in the variable. Therefore they should be used in preference to defining our own and using integers as kludge. -- அகிலன் (Akilan R) [ blog.akilan.in ] *I should have no use for a paradise in which I should be deprived of the right to prefer hell.* --Jean Rostand _______________________________________________ ILUGC Mailing List: http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
