Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: C++
Expertise: Beginner
Dec 23, 1999

Replacement for the "Finally" Keyword

Question:
I'm wondering whether there is any good replacement for Java's "finally" keyword (that executes regardless of whether an exception is thrown a keyword) in C++. I'm trying to switch to C++ try/catch exception handling but I'm stuck writing cleanup code in lots of places. (I'd rather not use Microsoft's "__finally", for portability issues.)

Answer:
Use destructors for the purpose of unconditional cleanup in C++.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date