On Jul 24, 2009, at 10:52 AM, Mike Stump wrote: > 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. >
Yeah I got it. Thanks Mike! Your code was correct, although I still prefer the use of a variant as it makes it less error prone with future changes to the code. It also makes the algorithm more clear. _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
