Array as an argument, ambiguous behaviour.
Steven Schveighoffer
schveiguy at yahoo.com
Thu Jan 30 07:08:01 PST 2014
On Thu, 30 Jan 2014 09:18:40 -0500, Cooler <kulkin at hotbox.ru> wrote:
> Forgot to mention :)
>
>>> I read the rest of the discussion. Arrays are hard to understand in D,
>>> especially if you have preconceived notions from other languages. But
>>> I would point out that fun2 does not "guarantee" anything more than
>>> fun3:
>>>
>>> void fun2(ref int [] x)
>>> {
>>> fun3(x);
>>> }
> "But I would point out that fun2 does not guarantee anything more than
> fun3:" - fun2() cannot guarantee anything because it calls fun3() which
> in turn cannot guarantee anything.
Right, but you said this:
> fun2(a); // Guaranteed that we will see any change to "a", made in fun2()
Which is false. That was my point.
-Steve
More information about the Digitalmars-d-learn
mailing list