Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does adding noexcept break binary compatibility?

Simple question: If change this:

void someMethod();

to

void someMethod() noexcept;

will it break binary compatibility, or does the method signature remain the same?

like image 957
Felix Avatar asked Jul 19 '18 18:07

Felix


People also ask

Should I use Noexcept?

In general, you should use noexcept when you think it will actually be useful to do so. Some code will take different paths if is_nothrow_constructible is true for that type. If you're using code that will do that, then feel free to noexcept appropriate constructors.

What does Noexcept mean in C ++?

noexcept (C++) C++11: Specifies whether a function might throw exceptions.


1 Answers

Does the method signature remain the same ?

Yes. https://en.cppreference.com/w/cpp/language/noexcept_spec :

Functions differing only in their exception specification cannot be overloaded (just like the return type, exception specification is part of function type, but not part of the function signature) (since C++17).

Will it break binary compability ?

Probably not, but standard doesn't guarentee anything (AFAIK).

like image 171
darune Avatar answered Sep 23 '22 12:09

darune