Re: g++, namespace std and STL
On Mon, Jan 15, 2001 at 01:04:28AM +1100, Chris Leishman wrote:
> Hopefully someone can set me straight on this one...
>
>
> - The STL, as distributed with g++, does NOT use namespaces as it should. It
> appears to be an older (or modified) version of the STL from that on the
> SGI website. Why is this different or old?
>
> In "stl_config.h", __STL_NO_NAMESPACES is defined when building with
> __GNUC__ 2.95.2 - which prevents the STL from putting things in the std
> namespace (where they supposively belong).
You can't use the SGI STL with GCC, I think. It just won't work.
Similarly, GCC 2.95.2 has insufficient namespace support for the SGI
STL.
> - The stl-manual, distributed as a debian package, is for the more recent SGI
> releases of the STL. Several things that this package talks about are
> simply not in the version of the STL as provided with g++.
Not really avoidable, I guess...
> - g++ by default, ignores the "std" namespace - assuming everything declared
> within the namespace as global (basically removing the std:: component).
>
> However, you can make g++ do "the right thing" by providing -fhonor-std on
> the compile line. However then binaries fail to link because the symbols in
> the libstdc++-* libraries do NOT contain the std:: component, and thus do
> not resolve. (Eg. std::terminate)
>
> Why is the library compiled in this way?
Because of failures in the insufficiently tested namespace code, I'd
guess.
Note that the 2.95 g++ implementation is hideously inconformant, and
the STL with it... G++ 3.0 should be available for testing very shortly
now, and is a world of improvement.
Dan
/--------------------------------\ /--------------------------------\
| Daniel Jacobowitz |__| SCS Class of 2002 |
| Debian GNU/Linux Developer __ Carnegie Mellon University |
| dan@debian.org | | dmj+@andrew.cmu.edu |
\--------------------------------/ \--------------------------------/
Reply to: