On Thursday, 25 August 2022 at 17:38:25 UTC, Steven Schveighoffer wrote:
>if(val > maxBW) delaySending();
If val
or maxBW
are NaN, this will always be a false condition (because of the wonderful property that comparisons with NaN are always false), so that code effectively never executes. Note that there's no printf
here, and the code happily compiles and runs, it just does something unexepected.
0 is no better here but also no worse.
In hindsight, the robust way to solve this would be that trying to compare NaN to anything would crash the program.
No way to add that to D without too much breakage though, I'm afraid.