On Wednesday, 18 April 2012 at 04:55:23 UTC, Ali Çehreli wrote:
On 04/17/2012 02:00 PM, simendsjo wrote:

> Sounds like a bug. C style initializers work in other cases:

I try not to use them. I think they have this 'feature' of leaving unspecified members uninitialized:

struct S
{
    int i;
    double d;
}

void main()
{
    S s = { 42 };               // <-- no initializer for S.d
    assert(s.i == 42);
    assert(s.d == double.nan);  // <-- fails (may work for you)

You should use std.math.isNaN whether a floating point value is NaN.

      assert(isNaN(s.d));  // <-- success

}

Is that a bug or a feature? I might have opened it but I don't remember now. :)

Ali

Bye.

Kenji Hara

Reply via email to