newbie prob: referenced parameter only partially changed

J D digitalmars at dresserfamily.org
Sun May 20 13:45:45 PDT 2007


Love the language, from the description.  My first day trying to program in D.

I pass a dynamic char array to a function.  I modify the contents and set the .length to a smaller value (confirmed from within the routine).  When I return the array I passed in has the contents changed, but the length has not changed.  This seems inconsistent to me.

I tried putting 'ref' before the 'char []' in the function declaration, but I got a bunch of errors,although the docs said arrays are passed by reference by default.  Can anyone help?



More information about the Digitalmars-d mailing list