[Dev] STL

Tanner Lovelace dev@trilug.org
06 Jan 2002 03:48:27 -0500


--=-nokI9k7t5nmNoQFm3Bf8
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Sun, 2002-01-06 at 00:55, Ed Hill wrote:
> I've used the STL a lot in the past (originally with the Rogue Wave STL
> implementation on HP-UX and Suns and later with EGCS/GCC on Linux).=20
> I've found that it can be *QUITE* painful to port STL code from one
> compiler/library to another or even to a newer rev of the same
> compiler/library.  The reason is that different template libraries are
> of varying complexity (using more or less template features) and they
> tend to *really* exercise the compiler.  So be careful!   Stuff that I
> wrote that worked well with the old HP aC++ and EGCS releases is now
> very broken with the RH 7.x gcc (gcc "2.96"), with the more recent 3.x
> gcc versions, and with other C++ compilers.  And broken template code
> just sucks to debug.

Unless you're writing STL code under windows using Visual C++ (which,
btw, sucks for template support) you shouldn't have any problem
using the STL.  That may have been different in the past, but now that
we have a standard and compilers are actually implementing it, there
shouldn't be any problems.  If there are, you can always uses the SGI
STL...
=20
> In terms of STL docs, I've used B. Stroustrup's text (excellent), the
> Rogue Wave HTML docs that come with their implementation (ok), online
> docs from the SGI STL implementation (ok), and some more esoteric refs
> (eg. Barton & Nackman's "Scientific and Engineering C++").
>=20

I would highly, highly, highly, highly, highly, highly, highly recommend
"The C++ Standard Library" by Josuttis (published by Addison Wesley).
It is by far the best STL book I have ever seen (and I've looked at=20
several, but not the latest version of Musser and Saini...)

> If all you want are decent implementations of some data structures and
> algorithms, then I strongly suggest that you look into something other
> than the STL.  Take a good look at the C-based Glib
>=20
>   http://developer.gnome.org/arch/gtk/glib.html
>=20
> library which you can, of course, use within C++.  Its *very* portable.=20
> And most of the data structures and algorithms that you're likely want
> are in there...
>=20
Yes, you can use glib in C++, but you lose way too much of the=20
power of C++.  Face it.  Using C code when you could use C++
is a hack.  It's ugly and it makes you do way to much stuff.  C++
was written so you don't have to do that stuff so you might as
well use it.

Okay, now that everyone knows my biases :-) I'll go back to what
I was doing.

Tanner Lovelace
--=20
Tanner Lovelace | lovelace@wayfarer.org | http://wtl.wayfarer.org/
--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--
GPG Fingerprint =3D A66C 8660 924F 5F8C 71DA  BDD0 CE09 4F8E DE76 39D4
--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--*--
 Those who are willing to sacrifice essential liberties for a little=20
 order, will lose both and deserve neither.  --  Benjamin Franklin=20

 History teaches that grave threats to liberty often come in times
 of urgency, when constitutional rights seem too extravagant to=20
 endure.  --  Justice Thurgood Marshall, 1989=20

--=-nokI9k7t5nmNoQFm3Bf8
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQA8OA9bzglPjt52OdQRAtBjAKCXDOKdOhgZXUn7dOAR2k9p13ahxQCePnd3
OIlJVl78t5kRiTfnYNKpyZk=
=DELi
-----END PGP SIGNATURE-----

--=-nokI9k7t5nmNoQFm3Bf8--