On Aug 23, 2011, at 6:04 AM, Don wrote:

> Sean Kelly wrote:
>> Was this broken condition something that could have been detected 
>> statically?  I've encountered plenty of broken conditions, but I've never 
>> had a compiler correctly flag one such.
> 
> Yes.
> 
> if (a > C1 && a < C2) ...
> 
> where C1, C2 are compile-time constants, and C1 > C2.
> (correct condition was: a > C2 && a < C1)

Huh… perhaps the issue is simply that I don't tend to have many complex 
conditionals involving comparisons with numeric constants.  The tricky ones 
most often involve the result of at least one function call, and I suspect 
there's little that can be statically determined about those.

Reply via email to