[Issue 1060] inout in arguments breaks the lvalueness of function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 14 13:20:07 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1060


gavrilyak at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED




------- Comment #2 from gavrilyak at gmail.com  2007-03-14 15:19 -------
Thanks for explanation, it's clear. That's how it's supposed to work and C++
works same way too, though it looks like premature optimization.
For me semantics of those 2 snippets is the same
int[] boo(inout int[] arr){
  return arr;
}

int[] arr = [1,2,3];
//first - works
int[] temp = boo(arr);
boo(temp);
//second
boo(boo(arr));


May be D can be less restrictive then C++ and this issue is just a feature
request :-).


-- 



More information about the Digitalmars-d-bugs mailing list