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

g++, namespace std and STL



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).


- 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++.


- 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?



Thanks for any answers,

Chris


-- 
----------------------------------------------------------------------
       Knuth: premature optimisation is the root of all evil.
----------------------------------------------------------------------
Reply with subject 'request key' for GPG public key.  KeyID 0xB4E24219



Reply to: