This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: try/finally in GNU C


>   while looking into a recent mismatch between GCC-4.x and a C dialect
> EH implemented as setjmp/longjmp, I recalled there was a talk about
> extending GNU C with __try/__finally construct:  
> 
>   http://gcc.gnu.org/ml/gcc-patches/2002-11/msg00239.html
> 
> What happened to that project?  Is it dead for good?

Doesn't the cleanup attribute to a variable do close to the same thing?
http://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html

cleanup (cleanup_function)
    The cleanup attribute runs a function when the variable goes out of scope. This attribute can only be applied to auto function scope variables; it may not be applied to parameters or variables with static storage duration. The function must take one parameter, a pointer to a type compatible with the variable. The return value of the function (if any) is ignored.

    If -fexceptions is enabled, then cleanup_function will be run during the stack unwinding that happens during the processing of the exception. Note that the cleanup attribute does not allow the exception to be caught, only to perform an action. It is undefined what happens if cleanup_function does not return normally.


-- Andrew Pinski


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]