nothrow by default

Ola Fosheim Grostad ola.fosheim.grostad at gmail.com
Sat Jan 11 22:57:22 UTC 2020


On Saturday, 11 January 2020 at 14:38:50 UTC, Jonathan M Davis 
wrote:
> noexcept does the same thing as throw(), but throw() is going 
> away along

Not quite. In c++17 throw() was redefined to noexcept, but prior 
to this it should unwind the stack with unexpected as the 
exception. Noexcept may or may not unwind the stack and allow 
optimizations.

> with throw(MyExceptionType). So, with throw(...) removed, C++ 
> ends up with a
> solution similar to what we currently have in D except that 
> noexcept is a

Noexcept is now part of the function type and you can test 
expressions with the noexcept operator. I believe it is more to 
support generic programming and optimization than to prevent bad 
behaviour.




More information about the Digitalmars-d mailing list