Re: Pass by Reference

new topic     » goto parent     » topic index » view thread      » older message » newer message
DerekParnell said...
jacques_desch said...

At parse time we know that a variable is on stack and so can forbid reference to it.

The problem is not so much that we make a reference to a stack variable, but that we allow that reference to be returned by the routine. For example, a routine could pass a reference to a local variable to another routine and that could be safe. So disallowing references to local vars or arguments is not what is required, but disallowing any such references to exist after the routine ends.

When passing references to stack vars to other routines, it is okay so long as those routines don't store the reference anywhere that will still exist after the original routine ends. This is difficult and requires flow analysis at run-time.

But don't we know at any time that a reference is pointing to stack? If so we can forbid storage or return of that reference without flow analysis?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu