3 ms·
These are my uses for unconditional noexcept, they are not all encompassing but they work for me, in all cases the exception guarantee of the code should be not
by leeter 10y ago
These are my uses for unconditional noexcept, they are not all encompassing but they work for me, in all cases the exception guarantee of the code should be noted:
* Code that will never throw an exception
* Code where throwing an unanticipated and therefore uncaught exception should trigger a failfast and crashing is not only the right behavior but the desired behavior. This should be the rarest of cases, but it does happen.
* Code that is called across an ABI boundary that it is not safe for an exception to cross. This is the most common case as OS callbacks fit this. This should be noexcept because having the exception propagate across exception unaware code causes bad things to happen, it's also undefined behavior to boot.