Skip to Content
C++ How to Program, 10/e
book

C++ How to Program, 10/e

by Paul Deitel, Harvey Deitel
February 2016
Beginner
1080 pages
207h 57m
English
Pearson
Content preview from C++ How to Program, 10/e

17.6 noexcept: Declaring Functions That Do Not Throw Exceptions

As of C++11, if a function does not throw any exceptions and does not call any functions that throw exceptions, you can explicitly state that a function does not throw exceptions. This indicates to client-code programmers that there’s no need to call the function in a try block. Simply add noexcept to the right of the function’s parameter list in both the prototype and the definition. For a const member function, you must place noexcept after const. If a function that’s declared noexcept calls another function that throws an exception or executes a throw statement, the program terminates. We’ll say more about noexcept in Section 24.4.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C++ How to Program, Sixth Edition

C++ How to Program, Sixth Edition

P. J. Deitel - Deitel & Associates, Inc., H. M. Deitel - Deitel & Associates, Inc.
C++ How to Program, Ninth Edition

C++ How to Program, Ninth Edition

Paul Deitel, Harvey Deitel

Publisher Resources

ISBN: 9780134448930Purchase book