NaNs Just Don't Get No Respect

Jesse Phillips jessekphillips+D at gmail.com
Sat Aug 18 07:29:10 PDT 2012


On Saturday, 18 August 2012 at 09:32:01 UTC, F i L wrote:

> It's flawed because condition2 relies upon condition1 to 
> function without error. The example, as Walter presented it, is 
> logically describing:
>
>     float f;
>     if (condition1) {
>         f = 7;
>         if (condition2)
>             f ++;
>     }

This greatly changes the semantics of the code. I do not disagree 
that the example indicates the original programmer is likely 
wrong and needs to improve the description of his intent.

What I disagree on is that it is that complaining that f might 
not be initialized will force the programmer to think and address 
the true issue. It is also taking the example at face value. The 
complexity of the relationship could be harder too see (I don't 
know what that would be), and somewhere else where condition1 is 
set there could be code:

auto condition1 = getmevalue();
enforce(condition1 && condition2, "Huston this is the problem!");

Someone is probably at fault and the one addressing the issue may 
still get it wrong; if it is the second programmer hopefully they 
will have more information about what they need as they were the 
ones changing the semantics of the code.


More information about the Digitalmars-d-announce mailing list