On Mon, 8 Nov 2010 18:13:54 +1000
"Daniel Murphy" <[email protected]> wrote:

> "spir" <[email protected]> wrote in message 
> news:[email protected]...
> 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. 
 
Then, if I pass a huge array/string or struct as "in", it is copied, right? Is 
the only way to avoid copy then to pass as ref?
I take the opportunity to ask about dynamic arrays. There is an internally 
pointed element-array, but is the array's interface (the kind of struct holding 
ptr & length) itself implicitely referenced?

Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com

Reply via email to