Given these structures and declaration:
struct CoordList{
int x, y;
}
struct Part{
int x, y;
CoordList[] coords;
int nextNode, prevNode;
string nextEnter, prevEnter;
}
Part[10] trackTemplates;
Can someone please tell me why I can't initialise Part[0].co
trackTemplates[0].coords = [ CoordList(0, 9), CoordList(1, 1),
CoordList(3, 6) ];
On Tuesday, 21 June 2016 at 19:15:56 UTC, Paul wrote:
Given these structures and declaration:
struct CoordList{
int x, y;
}
struct Part{
int x, y;
CoordList[] coords;
int nextNode, prevNode;
string nextEnter, prevEnter;
}
Part[10] trackTemplates;
Can s
On Tuesday, 21 June 2016 at 19:33:31 UTC, cym13 wrote:
i would want him to figure that by himself, tbh. just to remember
that "{}" struct initialization is BAD. ;-)
On Tuesday, 21 June 2016 at 19:33:31 UTC, cym13 wrote:
... but “trackTemplates[0].coords = [{0, 9}, {1, 1},
{3, 6}];” is an assignment so the compiler can infer as much
and doesn't understand that each of those list of values are
really CoordLists.
I see, but it seems a bit strange given that
On Wednesday, 22 June 2016 at 06:43:12 UTC, Paul wrote:
Why is initialisation via {} bad (in simple terms please :D)?
first, it is buggy. i.e. it doesn't always call postblit[1].
second, it's syntax is the same as the syntax of argument-less
lambda, which makes it context-dependent -- so read
On Wednesday, 22 June 2016 at 08:06:26 UTC, ketmar wrote:
On Wednesday, 22 June 2016 at 06:43:12 UTC, Paul wrote:
Why is initialisation via {} bad (in simple terms please :D)?
first, it is buggy. i.e. it doesn't always call postblit[1].
second, it's syntax is the same as the syntax of argumen
On Wednesday, 22 June 2016 at 09:27:01 UTC, cym13 wrote:
On the other hand I don't see why you'd expect {} to call
postblit at
all.
'cause it essentially makes a copy. i gave the sample in
bugreport. it worth me a hour of debugging to find why my
refcounted struct keep crashing with invalid
On Wednesday, 22 June 2016 at 09:27:01 UTC, cym13 wrote:
what i meant is that "{}" should be fully equivalent to
"Struct()" ctor in terms of calling postblits, and it isn't.