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: GCC Feature question


Well, sometimes there are things you want to do locally in your code that don't necessarily involve object destruction, and you'd like these things to happen whether or not an exception was thrown. These are the types of things we are anxious for try/finally.

M

>>> Jason Merrill <jason@redhat.com> 10/01/02 01:30PM >>>
On 27 Sep 2002 20:42:56 -0700, Aldy Hernandez <aldyh@redhat.com> wrote:

>  > We are porting apps to UNIX from Windows but so far can't find a
>  > compiler with try/finally. It is such a useful, convenient construct
>  > it is hard to imagine structured programming without it.
>
> C or C++?  With C++ you can emulate it with constructors, albeit ugly.

It's not *that* ugly.  For C++ using a destructor encourages you to write
reusable finalization code.

Jason


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