Topic: Throw statements in function declarations/d
Author: clamage@taumet.Eng.Sun.COM (Steve Clamage)
Date: 7 Jul 1994 22:32:08 GMT Raw View
In article 9kv@gazette.bcm.tmc.edu, rossd@wilkins.iaims.bcm.tmc.edu (Ross Dargahi) writes:
>Is an empty throw clause in a function declaration/definition part
>of the standard or is it still experimental.
>
>eg.
>
>void foo() throw();
>
>void foo() throw()
>
>{
> ...
>}
Well, we don't have a standard yet, so it's all sort of experimental :-(
But, yes, you can use an empty exception-specification to declare that a
function does not throw any exceptions. The run-time system will enforce
the declaration by calling unexpected() if a such a function tries to
pass along any exception. The compiler will disallow any throw clause
in the function itself.
This all assumes your compiler supports exceptions.
---
Steve Clamage, stephen.clamage@eng.sun.com