Escape analysis

Michel Fortin michel.fortin at michelf.com
Mon Oct 27 17:36:25 PDT 2008


On 2008-10-27 17:33:36 -0400, Walter Bright <newshound1 at digitalmars.com> said:

> Pure functions almost implicitly imply that its parameters are all 
> scoped. The exception is the return value of the pure function. If the 
> return value can contain any references that came from the parameters, 
> then those parameters are not scoped.

Not if you define "scope" in the function prototype as not escaping the 
caller's scope. That would mean that you can recieve a "caller scope" 
pointer on input and return it back to the caller when the function 
ends. It never escapes the caller's scope, so all is fine.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list