Bug 4552 – Struct initialization results in struct member garbage values
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-08-01T10:23:00Z
Last change time
2010-10-07T07:35:43Z
Assigned to
nobody
Creator
andrej.mitrovich
Comments
Comment #0 by andrej.mitrovich — 2010-08-01T10:23:51Z
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 by clugdbug — 2010-10-07T07:35:43Z
*** This issue has been marked as a duplicate of issue 2485 ***