<div dir="ltr">Hi Guy,<br><br>C89 doesn't have the concept of "bool" - all comparisons return an int (or is it an unsigned int?) in the range [0,1].<div><br></div><div>C99 and C++ build on C89 so even though they have the concept of "bool", the type of a comparison was not changed.</div><div><br></div><div>Cheers,</div><div><br></div><div>James</div><div><br></div><div>[Even though this C-language question seems easy enough for me to answer, I am certain that a true language lawyer will pipe up and tell me I'm wrong ;) ]</div></div><br><div class="gmail_quote">On Fri Feb 06 2015 at 4:37:11 PM Guy Maurel <<a href="mailto:guy.maurel@kde.org">guy.maurel@kde.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello!<br>
<br>
Let say:<br>
    int a = 5;<br>
    int b = 7;<br>
    int i = 20;<br>
    if ((a  == b) + i) {<br>
        a = 15;<br>
    }<br>
My question is:<br>
The expression (a == b) gives a bool result.<br>
Why is it allowed to add a "bool" and an "int".<br>
<br>
Thanks<br>
--<br>
Guy Maurel<br>
______________________________<u></u>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a><br>
</blockquote></div>