The marker noexcept
is a gurantee from the developer to the compiler that the function will never throw.
So you should add it to functions that you know Should never throw. If these functions do for some obscure and unknowable reason throw the only thing the compiler can do is terminate the application (as you guaranteed something that should not happen). Note: from a function marked noexcept you should probably not call another function unless it is also marked noexcept (just like const correctness you need to have noexcept correctness)
Where you should use it:
swap() methods/functions.
Swap is supposed to be exception safe.
Lots of code works on this assumption.
Move Constructor
Move Assignment.
The object you are moving from should already be
fully formed so moving it is usually a processes of
swapping things around.
Also be marking them noexcept there are certain
optimizations in the standard library that can be used.
Note: This is usually the case.
If you can not guarantee that move/swap semantics are
exception safe then do not mark the functions as noexcept.
You don't want to call terminate on all exceptions. Most of the time I would allow the exception to unwind the stack calling destructors and releasing resources correctly.
It it is not caught then the application will terminate.
But most complex applications should be resilient to exceptions. Catch discard the initiated task log the exception and wait for the next command. Sometimes you still want to exit but just because my smudge operation in the graphics application fails does not mean I want the application to exit ungracefully. I would rather that the smudge operation is abandoned resource re-claimed and the application goes back to normal operations (so I can save exit and restart).