Ted Kremenek wrote: > On Jul 23, 2009, at 9:33 PM, Eli Friedman wrote: > >> (int)x == false is semantically equivalent to (int)x == 0 due to >> integer promotion rules. That said, it is slightly confusing the way >> it's written. >> > > > The problem isn't with 'x == 0', but with 'x == -1'. Since (I > believe) both '1' and '-1' convert to true when int is casted to a > bool, the 'KnownVal == true' would evaluate to true in both cases > (which isn't the desired behavior). > Integer promotion rules are the same no matter the values. In KnownVal == true the 'true' literal is converted to the integer 1, and KnownVal is not touched.
Sebastian _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
