noexcept
It is keyword in c++11 and it used with functions only and that guarantee that they will not emit exception(or can not throw exception). we can say in other words that function is NOT meant for throwing exception. Example
void fun1() noexcept;
What will happen if function with noexcept throw exception ?
Program will be terminated, you can see below example std::terminate is called.
Source code with example:
//Header file #include<iostream> void fun01() noexcept { std::cout<<"fun01"<<std::endl; } void fun02() noexcept { std::cout<<"fun02"<<std::endl; throw; } int main() { std::cout<<"noexcept"<<std::endl; fun01(); fun02(); return 0; }
Output:
noexcept fun01 fun02 terminate called without an active exception Aborted (core dumped)