This is the mail archive of the
mailing list for the GCC project.
Re: [I don't think it's off-topic at all] Linking speed for C++
On Wed, May 30, 2001 at 12:16:11AM +0200, Michael Matz wrote:
> I have the feeling, that -Bsymbolic should only be applied to functions
> (or other things for which indirection already exists), and not to data.
The rules can't be changed now. In any case, there are situations
in which you _want_ -Bsymbolic to apply to data. Namely, when the
data is private and not used between shared objects.
> (btw. what's sad is, that TheA wouldn't need to be shared data, after all
> it's private (C++-wise), and only accessible through accesors. Only that
> they get inlined is the reason why everything falls apart ;) Not that I
> want to turn of inlining for this)
Which highlights a point I've always considered a failing of C++ -- it
is exceedingly tedious to write classes that are resistant to ABI change.
You have to write stuff like
struct FooData *data;
// no inline members, constructors or destructors.
in one (public) header, and put FooData and whatnot in some other
(internal) header. Which is more or less exactly what you'd use
in plain C, but this is an OO language and people forget and are
lured by the siren song of "private".
Templates of course make the situation worse; fortunately for my
sanity, the last time I had to use C++ for real, templates didn't
actually work in real compilers so there was no temptation to be
burned by them. ;-)