Passing by Value vs. Reference

Oskar Linde oskar.lindeREM at OVEgmail.com
Tue May 2 01:07:28 PDT 2006


Craig Black skrev:
> Are structs in D passed by reference by default?  I know if I specify "out" 
> or "inout" they would have to be, but what about just regular parameters 
> without qualification?

Regular parameters without qualifiers are "in" by default. Structs as 
in-parameters are always passed by value. (Internally, there may be a 
pointer to a stack allocated copy involved depending on the local 
platform ABI, but that does not change the semantics.)


/Oskar



More information about the Digitalmars-d mailing list