struct members not default initialized?
Ali Çehreli
acehreli at yahoo.com
Mon Dec 28 14:10:20 PST 2009
bearophile wrote:
> This prints 42 0.000000 with the latest dmd2 and 42 nan with an older
dmd1.
You are unlucky then... ;) The following program leaves random values in
s.d with dmd 2.037. Here is one output:
42 -0.008821
> It can be a bug:
Yes it is! :)
http://d.puremagic.com/issues/show_bug.cgi?id=2485
Sorry for not finding it earlier; and thanks for you help.
> 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
Ali
More information about the Digitalmars-d-learn
mailing list