still confused about call by reference

Jarrett Billingsley kb3ctd2 at yahoo.com
Wed Oct 31 16:49:08 PDT 2007


"Jarrett Billingsley" <kb3ctd2 at yahoo.com> wrote in message 
news:fgb48g$2rqq$1 at digitalmars.com...
> "Hoenir" <mrmocool at gmx.de> wrote in message 
> news:fgb3h9$2q19$1 at digitalmars.com...
>>> You can read all about it in "Dynamic Initializaion of Structs" here: 
>>> http://www.digitalmars.com/d/1.0/struct.html
>> Thanks a lot for that link!
>> Though I don't really get the purpose of opCall. For normal member 
>> initialization struct literals are completely sufficient. opCall would 
>> just make sense as a copy constructor, but this does not work.
>
> Struct literals were added after static opCall was 'blessed', so static 
> opCall was the only way to fly for a while.  Even then, the dynamic struct 
> literals use a completely different syntax from the static struct 
> initializers (another big *sigh*).  But it's still useful to have a 
> constructor function to i.e. check valid values, perform preprocessing on 
> the values, fill in other members based on values that you give, etc.
>

Oh and I guess I should mention, struct to struct assignment is always 
defined as a bit copy.  You can't intercept it in any way. 




More information about the Digitalmars-d-learn mailing list