Does changing the order of public non-virtual non-inline overloaded methods in a stand-alone class break the ABI?
Before:
class MyFinalClass
{
public:
// ...
void doSomething(char c, int i, int n);
void doSomething(char c, int i);
// ...
};
After:
class MyFinalClass
{
public:
// ...
void doSomething(char c, int i);
void doSomething(char c, int i, int n);
// ...
};
Thanks!
The functions are linked by their name and signature, not by their position in the class. So no, you’re not breaking the ABI.
Virtual functions are a different matter because they’re linked by their position in a vtable (usually). This won’t be a problem if you consistently recompile every file that depends on the header that defines the order, but if the class exists in a library it could be a concern.