If your built-in function is a sheet-level function, that is, it does not call any functions, then theoretically the compiler can determine that it will not throw and omit any exception handling that could otherwise be generated. Thus, this may not be necessary.
Having said that, you should not expect performance noexcept from adding noexcept . Whichever code that was supposed to be created to handle exception propagation should not become more complex by adding noexcept . It is worth noting that the compiler is allowed to completely abandon the stack if an exception is thrown from the noexcept function. This is largely due to the direct benefits of noexcept .
Regarding style recommendations, first of all, consider whether noexcept will be a useful part of your interface. Things like move operations can greatly benefit from noexcept for algorithmic reasons, but apart from that you really need to decide where noexcept matters to you, your interface, and the users of your interface.
If this does not answer your question, feel free to comment on my answer, and I will clarify further.
Sidenote: throw() , as well as deprecated in C ++ 11, does not provide the same guarantees as noexcept . If an exception is thrown through the declared throw() function, the stack must be completely unwound to the caller of this function. See 15.5.2.1 in the N3337 version of the C ++ standard for a reference to this behavior.
source share