Why aren't exceptions in C++ checked by the compiler? -


C ++ provides a syntax for exceptions to the check, for example:

  zero (g) (exception); Zero F () throw ();  

However, the Visual C ++ compiler does not check them; Throwing flag is ignored only in my opinion, this exception feature is unusable, so my question is: Is there any way to ensure the compiler is sure that the exceptions are correctly captured Are / Reprint? For example, a Visual C ++ plugin or a separate C ++ compiler,

PS I want to see the compiler that the exceptions are captured correctly, otherwise You end in a situation where you have to catch around every single function call, even though they clearly tell that they will not throw anything .

Update: The Visual C ++ compiler shows a warning when throwing in the function marked with throw (). This is great, but sadly, when you call substrate which warns, for example:

  void f () throw (int) {int (13); } Zero () throw () {g (); } // There is no warning!  

Exception specification is very useless in C ++.

Not that it will not be implemented that no exception will be thrown, but only global function unexpected () will be called (which can be set) < / P>

The use of exception specifications mainly provokes itself to mislead (or your colleagues) in some false sense of security. Just better not to bother.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -