Returning dynamic array from the function

Era Scarecrow rtcvb32 at yahoo.com
Wed Oct 17 13:36:19 PDT 2012


> The only way that @safe could really be applicable would be if 
> it became @system to take the address of a local variable or to 
> slice a static array. And perhaps it should be, but that and 
> catching the most obvious cases are all that the compiler could 
> do to catch this for you.

  Hmmm, you could have the compiler add a runtime check and see if 
slices are stack allocated (EAX >= ESP I think), then quit with 
an error, or alternatively it would make a copy afterwards, or at 
least a warning.


More information about the Digitalmars-d-learn mailing list