struct members not default initialized?

bearophile bearophileHUGS at lycos.com
Mon Dec 7 17:11:13 PST 2009


This prints 42 0.000000 with the latest dmd2 and 42 nan with an older dmd1. It can be a bug:

import std.c.stdio: printf;

struct S {
    int i;
    double d;
}

void main() {
    S s = { 42 };
    printf("%d %f\n", s.i, s.d);
}

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list