implement __attribute__((cleanup(function)))

Fergus Henderson fjh@cs.mu.OZ.AU
Thu May 8 12:05:00 GMT 2003


On 06-May-2003, Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at> wrote:
> What would help, I guess, are references/statements by those in favor
> of try/finally and those against it.
> 
> If you (Plural) send self-contained explanations of your point of view
> to the gcc list or me, I'll happily forward them as well.

I'm not a fan of try/finally in C,
but I'd rather that than __attribute__((cleanup(function))).

My motivation is that try/finally is simple, clearly specified,
and well understood, and explicit.  I think introducing try/finally
is better than having C++-like implicit invocation of a destructor-like
function.  Semantically the two are about equally complicated, but
try/finally is much more C-like in its style.

I think the risk of incompatibility with future standards is small.
But if that is seen as a problem, I would rather it be addressed by
using different keywords, e.g. __gnu_try and __gnu_finally,
than by using a completely different syntax.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.



More information about the Gcc mailing list