[cfe-commits] r76911 - /cfe/trunk/lib/Analysis/CFG.cpp

Mike Stump mrs at apple.com
Fri Jul 24 10:52:23 PDT 2009


On Jul 23, 2009, at 9:19 PM, Ted Kremenek wrote:
> This looks a little suspicious to me.  Doesn't '-1' convert to  
> 'true' when an int is casted to a bool?  This would cause 'KnowVal  
> == true' to evaluate to true even when 'KnownVal' is -1.

I think everyone else covered this already, but yes, (bool)-1 converts  
to true, but that doesn't cause 'KnowVal == true' to evaluate to true  
even when 'KnownVal' is -1 as KnownVal isn't bool.  -1 Converts to -1,  
when converted to an int, and true, when converted to an int converts  
as 1, and -1 != 1.




More information about the cfe-commits mailing list