Passing dynamic arrays

bearophile bearophileHUGS at lycos.com
Mon Nov 8 09:40:47 PST 2010


Jens Mueller:

> I find this behavior rather strange.

I don't know if it's strange, but surely it is a little bug-prone corner of D. I have had two or three bugs in my code because of that.


> Arrays are neither passed by value
> (copying the whole array) nor by reference.

They are passed by "fat reference" :-)


> I think I should use ref int[] in the example above, shouldn't I?

Right.

Bye,
bearophile


More information about the Digitalmars-d mailing list