-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnoexcept.txt
More file actions
11 lines (9 loc) · 847 Bytes
/
noexcept.txt
File metadata and controls
11 lines (9 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
In C++, the "noexcept" keyword can be used to indicate that a function or a constructor is guaranteed to not throw any
exeptions. It is used as a function specifier, like "const" or "override".
When a function is marked as "noexcept", the compiler can generate more efficent code, as it knows that it does not have
to handle any exceptions that may be thrown by the function. Additionaly, when a function is marked as "noexcept", it
allows for certain operations, such as move constructors, to be called even in the presence of potentially throwing
functions, which would not be possible otherwise.
It is important to note that a function marked as "noexcept" can still return an error code, or set an error flag,
but it cannot throw an exception. If a function marked as noexcept throws an exception, the program will terminate
immediately.