Theoretically speaking, noexcept would improve performance. But it might also cause some problems on the other hand.
In most of cases, it shouldn’t be specified because the pros are too few to be considered and it might make your code upgrading painful. This post, written by Andrzej, introduces the reasons in detail.
If it’s too long, just take these suggestions I conclude from it:
- Annotate functions with
noexceptif- they were annotated with
throw()already, - or they are good candidates(listed in post) and never throw for sure,
- or they are move-constructors, move-assignments whose
noexceptannotation cannot be correctly deduced by compiler and their instances are supposed to be put into some STL container.
- they were annotated with
- Do not annotate the functions with
noexceptif- you are really concerned about reduced performance,
- or about the risk of calling
std::terminate, - or you are just not sure about the new feature,
- or you have doubts whether you should make your function
noexceptor not.