about exception specification

G

George2

Hello everyone,


How do you understand the comments from Bjarne about exception
specification?

--------------------
(section 14.6.1 Checking Exception Specifications)

The way to think about exception-specifications is to assume that a
function will throw any exception it can. The rules for compile-time
checking exception-specifications outlaw easily detected absurdities.
 
A

Alf P. Steinbach

* George2:
How do you understand the comments from Bjarne about exception
specification?

--------------------
(section 14.6.1 Checking Exception Specifications)

The way to think about exception-specifications is to assume that a
function will throw any exception it can. The rules for compile-time
checking exception-specifications outlaw easily detected absurdities.
--------------------

There are not that many rules for compile time checking of exception
specifications.

Without checking the standard, as I recall they apply

* When you override a virtual function: you can't use a more
permissive exception specification on the override.

* When you assign to or initialize a function pointer, ditto.

If instead these were permitted, then exception specifications could not
be relied on for virtual functions or function pointers.


Cheers, & hth.,

- Alf


PS: When quoting someone, please do provide a reference to the source of
the quote. You haven't done so here, and you didn't last time you posted.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top