Re: compile gcc and library

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

 



Xin Tong <xerox.time.tech@xxxxxxxxx> writes:

>> In general, yes.  For pure C code, yes.  For C++ code, some caveats may
>> apply.
>>
>
> This is the reason why gcc contains a c++ library, but no need for C
> library ?

A C library inherently has lots of system dependencies, like how to do
I/O on the system.  It's easier to maintain that separately from the
compiler.

A C++ library does not have those dependencies, because it can simply
use the facilities of the C library.  Also, a C++ library has some close
ties to the compiler, e.g., in how exceptions are implemented and
details of things like __is_pod.

Also and probably more importantly, historically GCC was developed on
systems that have C libraries but don't have C++ libraries.  So GCC
always needed to provide a C++ library, but rarely needed to provide a C
one.

> what kind of caveats , like different mangling styles ?

That is one, yes.  In general the C++ ABI is much more complex and
subtle than the C ABI, and there is a correspondingly higher chance of
some sort of breakage.  That said, it usually does work fine.

Ian



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux