several questions

Bill Baxter dnewsgroup at billbaxter.com
Sun Feb 17 07:06:17 PST 2008


Saaa wrote:
> But if I use a ref or a pointer, the function is allowed to change the 
> variable.
> Using 'in' will make a copy?

For D1, in is the same as nothing at all.  In D2 I think in is the same 
as 'invariant'.  So yeh, it will make a copy.

> I thought ref was just a renaming of  'inout'.
> But there is no way to only pass a reference without giving the function 
> write permission?
> 
> I sent a lot of big arrays in structs, so I think this is kind of crucial 
> for me :/

No way in D1.  Yes way in D2 (const ref or invariant ref should work in 
latest DMD).

--bb


More information about the Digitalmars-d-learn mailing list