[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: gcc-3.0 and C++



On Tue, 20 Nov 2001, Jason Williams wrote:

> Fair enough; it's just that "old" gcc never seemed to require that.
> Presumably I was incorrect in relying on that behaviour.

I believe that it is incorrect to rely on that.  It's possible that the
new operator was contained in libgcc in 2.95.4, meaning that it could
satisfy the symbol without libstdc++ (I just checked...2.95.x's libgcc has
a builtin new operator, while 3.0.x doesn't, which explains why it worked
with 2.95.x).

In either case, it's much safer to use the g++ invocation rather than gcc
when compiling C++ code.

I tried your example with both gcc 2.95.x and 3.0.x and confirmed the
above.  With 2.95.4 (unstable), the new operator is, in fact, using
__builtin_new, which is linked into the binary from libgcc.a.  3.0's
libgcc has no builtin new, so it needs libstdc++ to satisfy the symbol
at link time.  In fact, the 2.95.4 version isn't linked to libstdc++ at
all, fyi, since it uses no symbols from it.

Hope this helps...

C



Reply to: