On 08/17/2010 08:39 PM, Richard Henderson wrote:
On 08/12/10 19:50, Blue Swirl wrote:
+While using "bool" is good for readability, it comes with minor caveats:
+ - Don't use "bool" in places where the type size must be constant across
+ all systems, like public interfaces and on-the-wire protocols.
+ - Don't compare a bool variable against the literal, "true",
+ since a value with a logical non-false value need not be "1".
+ I.e., don't write "if (seen == true) ...". Rather, write "if (seen)...".
I'd strongly discourage the use of bool in any code.
I strongly disagree. The use of "bool", even if you ignore stdbool.h
and do "typedef int bool", is valuable documentation in the code.
I think "bool" is fine, but it should be either stdbool.h or a typedef.
Using stdbool.h only when it is present is going to introduce bugs the
day someone relies on the magic properties of the C99 bool.
Paolo