How can a function indicate that it will not throw any exceptions? 

  • By using the noexcept specifier 
  • By returning a null pointer 
  • By using the try block without catch 
  • By marking it as static
The noexcept specifier in C++11 and later indicates that a function does not throw exceptions. If such a function does throw an exception, the program will terminate (usually by calling std::terminate). This can be a useful optimization hint for the compiler.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *