There was [0]. It is deprecated and generally discouraged, since it quickly becomes a maintenance nightmare (since you have to include unhandled exceptions for all functions called from that function, etc, all the way down).
There was [0]. It is deprecated and generally discouraged, since it quickly becomes a maintenance nightmare (since you have to include unhandled exceptions for all functions called from that function, etc, all the way down).
The noexcept keyword was actually added to address some of the limitations.
Is there a better way to do it, maybe a static analyzer or IDE warning about possible exceptions?
Another way to express constraints are attributes, which static analyzers (and optimizers) also use. For example, GCC has a number of function attributes [2] to express invariants about code.
[1] http://clang-analyzer.llvm.org/scan-build.html#recommended_d...
[2] https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attribute...