appending newly initialized struct to array

Jonathan M Davis jmdavisProg at gmx.com
Wed Apr 18 16:50:35 PDT 2012


On Wednesday, April 18, 2012 11:18:44 Ali Çehreli wrote:
> On 04/18/2012 10:13 AM, Jonathan M Davis wrote:
> > On Wednesday, April 18, 2012 19:04:12 SomeDude wrote:
> >> On Wednesday, 18 April 2012 at 16:36:39 UTC, bearophile wrote:
> >>> Ali:
> >>>> That a thousandth time I have made that mistake and still have
> >>>> not learned. :( Yes, .nan may not be compared with any other
> >>>> value, including .nan.
> >>> 
> >>> Today I'll present an enhancement request to remove this
> >>> problem from D.
> >>> 
> >>> Hugs,
> >>> bearophile
> >> 
> >> I don't see how this could be enhanced.
> > 
> > It's by design. An enhancement request is a waste of time.
> 
> Comparisons with
> 
> > NaN _always_ return false regardless of what they're compared against
> 
> - even
> 
> > NaN. It's not going to change.
> > 
> > - Jonathan M Davis
> 
> It shouldn't be a problem to detect comparisons against literal .nan
> values. The compiler can warn with "comparison is always false".

Yes, that would make sense. Heck, I'd be tempted to argue that using == with 
floating point values in general should be a warning, since that's pretty much 
never what you actually want, but that's probably not going to fly.

But the behavior itself isn't going to change.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list