in-parameter

Daniel Murphy yebblies at nospamgmail.com
Mon Nov 8 00:13:54 PST 2010


"spir" <denis.spir at gmail.com> wrote in message 
news:mailman.157.1289146124.21107.digitalmars-d at puremagic.com...
I'd like to know, aside user-side semantics, whether the compiler uses the 
"in" qualifier for efficiency (pass arrays & structs by ref under the 
hood?). Well, seems obvious, but there may be some hidden constraint I'm 
unable to realise.

The spec states: "The in storage class is equivalent to const scope."

So, no, the compiler never implicitly uses ref to pass in parameters.

It could be possible with a rule like "pass by const ref if param.sizeof > x 
bytes", but I think this would require an abi change. 




More information about the Digitalmars-d mailing list