still confused about call by reference
Jarrett Billingsley
kb3ctd2 at yahoo.com
Tue Oct 30 14:42:45 PDT 2007
"Hoenir" <mrmocool at gmx.de> wrote in message
news:fg7o1e$2lhs$1 at digitalmars.com...
>> I think the opCall needs to be declared static.
>>
> opCall is used here as a "constructor" for that struct. Thus declaring it
> static doesn't make any sense to me. Are you sure it must be static?
This is the stupid compromise that we got instead of struct ctors in D1.
Use a static opCall, Walter says, it'll get optimized out. That's great,
but it makes it impossible to initialize an instance of a struct on the heap
without factoring out the initialization to _another_ function, and it's
just another stupid inconsistency which we'll have to live with even though
D2 will have struct ctors. *sigh*
You cacn read all about it in "Dynamic Initializaion of Structs" here:
http://www.digitalmars.com/d/1.0/struct.html
More information about the Digitalmars-d-learn
mailing list