This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: implement __attribute__((cleanup(function)))
On Mon, May 05, 2003 at 09:41:59PM -0300, Alexandre Oliva wrote:
> When f() is executed, is pi still in scope?
Yes, obviously. Otherwise we wouldn't be able to
reference its memory.
> But then, why is f() executed?
Because we are about to leave pi's scope.
> What is the expected output of this program?
false.
> This extension is obviously not as simple as one might think.
It's exactly equivalent to C++ destructors.
If we implemented nested functions in C++ you could write
something equivalent. Likewise I'm sure that contorted corner
cases can be found for try/finally.
> I still think coming up with a new extension is a mistake.
> I'd much rather go with try/finally, a well-known extension
> that is likely to be standardized, than coming up with a new
> extension with odd interactions with other extensions that
> we already have.
I refuse to have this discussion. I've done it twice now in
favour of try/finally, and now you want to start in on the only
technically sound replacement that's been proposed since.
Argue this with someone else and let me know when yall are done.
r~