[Issue 4553] New: D2 Language Docs: http://www.digitalmars.com/d/2.0/struct.html
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Aug 1 10:43:57 PDT 2010
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 at puremagic.com
ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at 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: -------
More information about the Digitalmars-d-bugs
mailing list