http://llvm.org/bugs/show_bug.cgi?id=15774
Jordan Rose <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |[email protected] Resolution|--- |INVALID --- Comment #1 from Jordan Rose <[email protected]> --- BoolAssignmentChecker isn't actually for checking C++/C99 bool; it's for types that are intended to be used as boolean variables but are actually typedefs of small integers, like Objective-C's BOOL. Why the distinction? For 'bool', coercion/casting always gives the same answer as testing with an if, while, or ?:. But for 'BOOL', a cast results in truncation, rather than truth-testing. Similarly, you can safely compare a 'bool' variable against 'false' or 'true', but a 'BOOL' variable may not always be 'NO' (0) or 'YES' (1), although it probably ought to be. So, yes, this is by design. You could argue that relying on an implicit int-to-boolean conversion is bad style, but that would be a separate argument, not a bug in the current checker. :-) -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ LLVMbugs mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs
