Array as an argument, ambiguous behaviour.

simendsjo simendsjo at gmail.com
Wed Jan 29 04:28:28 PST 2014


On Wednesday, 29 January 2014 at 11:46:23 UTC, Cooler wrote:
> Thank you for detailed explanation. But the question is - "Is 
> that correct that language allows ambiguous behavior?"

Could you expand your example?

fun(int[] a) {} is passing a by value, that is, the pointer and 
length is copied over to fun. Any changes to the elements of a 
will be visible, but if you reassign a directly or indirectly 
(expanding it so it needs to be copied to a new memory location), 
the changes are not visible.


More information about the Digitalmars-d-learn mailing list