Escape analysis

Bill Baxter wbaxter at gmail.com
Tue Oct 28 12:35:22 PDT 2008


On Tue, Oct 28, 2008 at 10:54 PM, Steven Schveighoffer
<schveiguy at yahoo.com> wrote:
>
> What I'd prefer is allocate closure when you can prove it, allow
> specification when you can't.  That is, allocate a closure automatically in
> simple cases like this:
>
> int *f() {int x = 5; return &x;}
>
> And in cases where you can't prove it, default to not allocating a closure,
> and allow the developer to specify that a closure is necessary:

So basically programmers have to memorize all the rules the compiler
uses to prove when it's necessary to allocate a closure, and then run
those rules in their heads to determine if the current line of code
will trigger allocation or not?

And when the compiler gets a little smarter, the programmers need to
get smarter, too.  In lock step.

That doesn't sound like a good solution to me.

--bb



More information about the Digitalmars-d mailing list