(I must be missing something here; this is such a fundamental operation and I 
can't find a bug report on it.)

I've been under the impression that struct members would always be initialized. 
Having seen D an init-happy language compared to C and C++, that's what I would 
have expected. :)

Shouldn't the members of s be int.init and double.init below?

struct S
{
    int i;
    double d;
}

void main()
{
    S s;
}

They are not; at least for dmd versions from 2.034 to 2.037.

Also, leaving out some of the initializers do not init the corresponding 
members either:

    S s = { 42 };

There, s.d is not double.init.

And static initializers don't help either:

struct S
{
    int i     = 1;
    double d  = 2.3;
}

Again, s.d is not initialized:

    S s = { 42 };

Is the above expected? (Not by me... :) )

Ali

Reply via email to