August 01, 2010 [Issue 4553] New: D2 Language Docs: http://www.digitalmars.com/d/2.0/struct.html | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=4553 Summary: D2 Language Docs: http://www.digitalmars.com/d/2.0/struct.html Product: D Version: D2 Platform: Other OS/Version: All Status: NEW Severity: normal Priority: P2 Component: www.digitalmars.com AssignedTo: nobody@puremagic.com ReportedBy: andrej.mitrovich@gmail.com --- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2010-08-01 10:43:56 PDT --- "Static Initialization of Structs" There is inconsistency between the examples. Replace X with S in all the examples. In the 4th example, this line: S s = { 1, i }; // q.a = 1, q.b = i, q.c = 0, q.d = 7 Should be replaced with: S q = { 1, i }; // q.a = 1, q.b = i, q.c = 0, q.d = 7 "Const and Invariant Structs" In the code example the statement t = s; is not compilable: const struct S { int a; int b = 2; } void main() { S s = S(3); // initializes s.a to 3 S t; // initializes t.a to 0 t = s; // ok, t.a is now 3 //~ t.a = 4; // error, t.a is const } test3.d(29): Error: variable test3.main.t cannot modify const "Struct Constructors" There are no code examples here. A simple one could be added: struct S { int x; int y; this (int x_val, int y_val) { x = x_val; y = y_val; } } void main() { S s = S(4, 5); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 15, 2012 [Issue 4553] D2 Language Docs: http://www.digitalmars.com/d/2.0/struct.html | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=4553 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |FIXED --- Comment #1 from Walter Bright <bugzilla@digitalmars.com> 2012-01-15 14:14:56 PST --- https://github.com/D-Programming-Language/d-programming-language.org/pull/54 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation