Declaring noexcept

C++11 introduced the noexcept keyword, which, besides simplifying how exceptions were used in general, also included a better implementation of C++ exceptions that removed some of their performance hits. However, this doesn't mean that exceptions do not include overhead (that is, performance penalties). In this recipe, we will explore how exceptions add overhead to an application and how the noexcept keyword can help reduce these penalties (depending on the compiler).

This recipe is important because it will demonstrate that if a function doesn't throw an exception, then it should be marked as such to prevent the additional overhead regarding the total size of the application, resulting in an application that loads faster.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset