Assume I have a library that declares a function returning const
type:
class Foo { ... };
const Foo makeFoo();
Now I want to remove const
from makeFoo()
return type (See my previous question). I can remove const
both from the header and the cpp file, rebuild the library, and link my code to the new library. However, I also have old code that is dynamically linked to this library, and I want it to continue to work with the new version of the library.
So, first question, does removing const
from return type break ABI?
Second question, the actual code is quite different: it is a template class that has a static member function and that is later explicitly instantiated:
// fooMaker.h
template<class Foo>
class FooMaker {
public:
static const Foo make();
};
// fooMaker.cpp
template<class Foo>
const Foo FooMaker<Foo>::make() { ... }
template class FooMaker<Foo1>;
template class FooMaker<Foo2>;
Is it changing anything?
If that's important, I'm using g++ under linux.