I wrote:
Shyan Lam replied:
>> 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)
In your case both expressions have equal result.
In my case, where I need to evaluate a single bit at time and y is the bit
being evaluated, both expressions have different results.
false is 0, but true have two meanings: a) value!=0 b) value==1
Did you never confuse the two true meanings?
And the standard writes "suitable for use in #if preprocessing directives"
but does not forbid "true" use inside if parenthesis.
____________________________________________________________________________________Shape
Yahoo! in your own image. Join our Network Research Panel today!
http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7
To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/c-prog/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/c-prog/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/