This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: stable STL implementation
- From: Joe Buck <jbuck at synopsys dot com>
- To: ncm at cantrip dot org
- Cc: libstdc++ at gcc dot gnu dot org ('libstdc++ at gcc dot gnu dot org'), vpatil at knightsindia dot co dot in
- Date: Tue, 3 Dec 2002 18:45:25 -0800 (PST)
- Subject: Re: stable STL implementation
Nathan Myers writes:
> Be aware that code that
> compiles against gcc-2.95's library is almost certainly not standard-
> conformant, so you will need to bring it up to date to work with a
> standard-conformant library.
I suspect that you left out an "only" here, as in
"Be aware that code that has only been compiled against gcc-2.95's ..."
because otherwise the statement is not correct. I have tons of completely
standard-conformant C++ code that makes full use of STL containers and
algorithms, and that builds with a large number of compilers, including
gcc-2.95.3, gcc-3.2.1, HP aCC (with -AA), Sun Forte 7, etc. It's not that
hard. I need the most #ifdefs for Sun, because they have an odd
combination of a compiler that can do template member functions and a
standard library that doesn't use them (probably for ABI compatibility
reasons), and that doesn't have iterator_traits. But if I'm just
interested in back-compatibility with 2.95.x, I rarely need #ifdefs at
all.
gcc-2.95's -fno-honor-std fakeout hack works quite well, meaning
that it's not hard at all to write C++ code that works with both old
and new GCC versions (forget about anything older than 2.95 though).
I would advise people doing free software in C++ to try to write their
code in a way that works for older gcc's where possible, as some folks
still have issues with newer gcc's.