Login | Register   
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: All
Mar 19, 1999

Empty Exception Specification

Some programmers tend to add an empty exception specification to constructor destructor, assignment operator, and copy constructor of a class:
 
class C {
public:
  C() throw();
  ~C() throw();
  C(const C&) throw();
  C& operator= (const C&); throw();
};
On some implementations, this practice can improve performance, because the compiler is free not to generate extra "scaffolding" code to support exception handling. However, on other implementations, adding empty exception specifications achieves the opposite result. You should check the compiler's documentation first to make sure that such empty exception specifications do not result in a performance penalty.
Danny Kalev
 
Comment and Contribute

 

 

 

 

 


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

 

 

Sitemap