__attribute__((cleanup(function)) versus try/finally

Alexandre Oliva aoliva@redhat.com
Thu May 8 20:19:00 GMT 2003


On May  8, 2003, Mark Mitchell <mark@codesourcery.com> wrote:

>> Err...  You're not using try/finally above,

> That was my point: try/finally isn't really the ideal construct.

Why not?  See, the finally case doesn't have the rethrow.  It comes
automatically from the semantics of finally.  This is the right
semantics for cleanups.  catch(...) doesn't get it right.

I do agree that the fact that the pthread cleanup is conditional in
the non-unwinding case makes it unsuitable for direct representation
as either a cleanup or a finally.  You need the conditional in either
case.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer



More information about the Gcc mailing list