Re:The Year of C++ Successor Languages
by mike_hock on Tuesday January 03, 2023 @03:49AM
(#34229335)
Which is how you get zero cost unless thrown. You're gonna have to pay for something.
[ Parent
| on HN ]
The RTTI requirement is more of an issue since that's forcing RTTI on for all types, not just those that can be thrown as exceptions. An explicit "throws" syntax would eliminate that (since the thrown type is now statically known and doesn't require RTTI) and thus significantly cut down on the cost.
Alternatively, and this isn't very "C++" but would work, it could be required that all thrown exceptions must inherit from a base "Exception" type such that you then only need to require RTTI for that chain of types instead of all types.