pointers, assignments, Garbage Collection Oh My?

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Wed Jul 10 19:35:51 PDT 2013


On Wednesday, 10 July 2013 at 17:18:09 UTC, JohnnyK wrote:
> export string mytest(string tstStr)
> {
>   string st = tstStr;
>   /* abbreviated to protect the innocent but other operations
>      such as concatenating and deleting may be done to st 
> before the return
>   */
>   return st;
> }


Arrays are complex, as mention see: 
http://dlang.org/d-array-article.html

The snippet shown, st references the same data as tstStr.

The comment states "concatenating," then st does not point to the 
same data as tstStr.


More information about the Digitalmars-d-learn mailing list