Pedro Izecksohn wrote:
> Saurabh Jain asked:
>
>   are you sure x&y == x&&y???
>
>   Am I missing something?
>
> Pedro's reply:
>
>   Shyan Lam, thinking that I mistyped, meant that:
>
>     if ((x && y) == true)
>
>   may be shortened to:
>
>     if (x && y)
>
>   But my bug was to think that:
>
>     if (x&y)
>
>   is equivalent to:
>
>     if ((x&y)==true)
>
>   My opinion is that the ISO committee made a bad decision when it defined 
> the boolean type at 6.3.1.2
I guess you guys must be talking about C, not C++...but I'll comment 
about your misunderstanding of the standard anyhow.
You ass/u/med that == true would have some meaning. IMO it's either a 
waste of ink, or it's wrong.
the only _problem_ occured when you made the above assumption.
now, IF there is a boolean type (bool in C++) one MUST have the ability 
to assign the values for false and true.  For compatability with C, C++ 
chose  0 and 1 respectively.  Now you can, if you need, write
bool t = true;
bool f = false;

I'm puzzled what induced you to ever write if((somexpession) == true)
it's not the way we talk "If George gets 3 hits in todays baseball game 
(is true), I win, if not, you do"
the parenthetical statement (is true) being the spoken equivalent of == true
it's not the way we think either (at least no one has ever mentioned 
this to me)

>  but defined the macro true to be the integer 1 at 7.16ยง3 . The macro true 
> should be of type boolean, not an integer, and to compare between an integer 
> and a boolean without casting should generate a warning.
>   
I'm sorry you're stuck with a language that needs a MACRO to define true 
and false...switch to C++ where they're real keywords.
though it wouldn't complain if you wrote if((a&b) == true) either
>
>
>
>
>        
> ____________________________________________________________________________________Building
>  a website is a piece of cake. Yahoo! Small Business gives you all the tools 
> to get online.
> http://smallbusiness.yahoo.com/webhosting 
>
>
> To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>. 
> Yahoo! Groups Links
>
>
>
>
>
>
>   

Reply via email to