Subj : Re: try/finally in C++ To : borland.public.cpp.borlandcpp From : maeder Date : Thu Jul 08 2004 07:21 pm "Dennis Jones" writes: > Does anyone know if there is a way to get try/finally functionality from the > Borland C++ compiler (version 5.0x) when compiling C++ code? BC 5.0x only > seems to support __try/__finally in C mode (not C++), and in C++ mode, it > only seems to support try/catch (no "finally"). I'd really like to get > something like the try/__finally support that is available in BCB. Is this > possible with the older 5.0x compiler? I don't think so. I also don't see why finally should be needed in Borland C++. This extension was added along with VCL support, because VCL objects don't behave like real C++ objects when it comes to cleaning up after themselves. The native C++ approach for objects to properly release "their" resources is RAII (Resource acquisition is initialization): wrap each allocated resource into an object that solely exists for releasing the resource once it's no longer needed. Google for "C++ RAII" if you want to know more. .