D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4552 - Struct initialization results in struct member garbage values
Summary: Struct initialization results in struct member garbage values
Status: RESOLVED DUPLICATE of issue 2485
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-01 10:23 UTC by Andrej Mitrovic
Modified: 2010-10-07 07:35 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrej Mitrovic 2010-08-01 10:23:51 UTC
This is a modified example from the structs page in the d spec:

import std.stdio;

struct S { 
    int a;
    int b;
    int c;
    int d = 7;
}

void test(int i)
{
    S q = {2, i};
    writeln(q);
}

void main() { 
    test(4); 
}


This writes S(2, 4, 33686018, 33686018). 
These look like garbage values to me.
Comment 1 Don 2010-10-07 07:35:43 UTC

*** This issue has been marked as a duplicate of issue 2485 ***