Reply embedded...

> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
> Of Pedro Izecksohn
> Sent: Saturday, May 26, 2007 10:15 PM
> To: [email protected]
> Subject: [c-prog] ISO/IEC 9899:1999 stdbool.h true
> 
>   If any value not zero is true why "true which expands to the integer
> constant 1"?
> 
>   I wasted a week to find a bug that I wrote like:
> 
> if ((x&y)==true) //etc

'&' is a bitwise-AND operator.  I think what you really meant is
"logical-AND" (&&).

    if ((x && y) == true)

Unless you want 'y' to be evaluated regardless of the result of 'x'.


>   but I should have written just:
> 
> if (x&y) //etc

It still can be shorten to:

    if (x && y)

HTH
Shyan



Reply via email to