Disallow (dis)equality with FP.nan/FP.init literals

Somedude lovelydear at mailmetrash.com
Thu Apr 19 01:27:02 PDT 2012


Le 19/04/2012 02:50, bearophile a écrit :
> This is an open enhancement request that I'll probably add to Bugzilla.
...
> So I propose to statically disallow comparisons of Program #3, so it
> generates errors similar to:
> 
> test.d(4): Error: comparison is always false. Use 'std.math.isNaN' to
> test for every kind of NaN or 'is float.nan' for this specific NaN
> test.d(6): Error: comparison is always true. Use '!std.math.isNaN' to
> test for every kind of NaN or '!is float.nan' for this specific NaN
> test.d(8): Error: comparison is always false. Use 'std.math.isNaN' to
> test for every kind of NaN or 'is float.init' for this specicif NaN
> ...
> 
> 
> Opinions, improvements, votes or critics are welcome.
> 
> Bye,
> bearophile

Looks like a good one !


More information about the Digitalmars-d mailing list