<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:jordan_rose@apple.com" title="Jordan Rose <jordan_rose@apple.com>"> <span class="fn">Jordan Rose</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - BoolAssignmentChecker not catching literals"
href="http://llvm.org/bugs/show_bug.cgi?id=15774">bug 15774</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>jordan_rose@apple.com
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>INVALID
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - BoolAssignmentChecker not catching literals"
href="http://llvm.org/bugs/show_bug.cgi?id=15774#c1">Comment # 1</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - BoolAssignmentChecker not catching literals"
href="http://llvm.org/bugs/show_bug.cgi?id=15774">bug 15774</a>
from <span class="vcard"><a class="email" href="mailto:jordan_rose@apple.com" title="Jordan Rose <jordan_rose@apple.com>"> <span class="fn">Jordan Rose</span></a>
</span></b>
<pre>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. :-)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>