Clause / Subclause / Annex:
15.4
Comment type:
Ge
Comment / justification for change:
Exception specifications have proven close to worthless in practice, while adding a measurable overhead to programs. The feature should be deprecated. The one exception to the rule is the empty throw specification which could serve a legitimate optimizing role if the requirement to call the runtime unexpected mechanism was relaxed in this case.
Recommended change:
Move 15.4 and the parts of 15.5 that refer to it to Appendix D. Replace 15.4 with a simpler specification for empty throw specifications, where the std::unexpected call is conditionally supported allowing vendors to choose between optimizing and providing runtime checks. Ideally require vendors to provide a mode where the runtime checks are always disabled.
MB:
UK
I have to agree with this
I have to agree with this as it cleans up a feature with unclear usefulness. It also provides a useful syntax for specifying no-throw in the library.
From our discussions on this Alisdair was careful to point out that there are two points here:
1. Deprecate exception specifications
2. Allow empty throw specifications to be relaxed as noted in the original comment.
A second compromise noted by Alisdair was to provide a nothrow attribute, but this would provide two ways to say the same thing.