[Exceptional C++ Style] Item 13: A Pragmatic Look at Exceptio nSpecifications

Ric Parkin ric.parkin at ntlworld.com
Tue Dec 7 06:57:41 EST 2004


From: David Sykes <d.sykes at pindar.com>
> > I think it would be better if exception specifications were 
> > enforced at
> > compile time. What do people think?
> > 
> 
> Don't you have the same problem you have with const that as soon as you
> enter a function that cannot throw then every function it calls must be
> defined as unable to throw anything

Thats one of the problems.
 
>  void MyFunc() throw()
>  {
>       printf("Hello world");		// We know this won't throw, but can
> the compiler?
>  }

In this case you probably could - known C-library functions culd be known to the compiler as no-throw, even if they aren't marked as such.

I don't think extern "C" implies nothrow though.

Ric


-----------------------------------------
Email provided by http://www.ntlhome.com/





More information about the Effective-cpp mailing list