c++noexceptbinary-compatibility

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?


Solution

  • 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).