Array as an argument, ambiguous behaviour.

Steven Schveighoffer schveiguy at yahoo.com
Thu Jan 30 07:29:50 PST 2014


On Thu, 30 Jan 2014 10:24:14 -0500, Cooler <kulkin at hotbox.ru> wrote:

> On Thursday, 30 January 2014 at 14:40:36 UTC, Dicebot wrote:
>> On Thursday, 30 January 2014 at 13:42:53 UTC, Cooler wrote:
>>> If I use fun2() I expect that fun2() will change the content of my  
>>> array, and all changes I will see. If I don't want any change to my  
>>> array, I will use fun1(). What should I want to use fun3()?
>>
>> For changes to content of array but not array itself.
>
> I agree. I just want that the case can be expressed in language syntax  
> more obvious - something like "fun(int[] const x){}" to emphasize that I  
> understand that fun() can change content of array, and cannot change the  
> {pointer,size} pair.

That's what fun(int[] x) does :)

-Steve


More information about the Digitalmars-d-learn mailing list