Used to indicate when it is an error to ignore a return value from a function, should be used extensively, any non-mutating(getter/accessor/const) function should be [[nodiscard]]
noexcept notifies the user(and compiler) that a function may not throw an exception. If an exception is thrown from that function, terminate MUST be called.
void foo() noexcept { // required to terminate the program throw 52;}int main() { try{ foo(); } catch(...) { // catch is irrelevant, `terminate` is called } return 0;}
Compiler stderr<source>: In function 'void foo()':<source>:2:5: warning: 'throw' will always call 'terminate' [-Wterminate] 2 | throw 52; | ^~~~~~~~Program returned: 139Program stderrterminate called after throwing an instance of 'int'Program terminated with signal: SIGSEGV