Anyone who’s been around a C++ programmer for any length of time has probably realized that we tend to be horrible language lawyers: we only trust the ISO standard describing the language. We certainly would never assume something to work just because the compiler happens to generate code that works right now. If it’s not in the standard, we can’t count on it.
I’m fine with that. It’s often annoying that we have to be so paranoid, that we so often have to double-check that our code not only compiles, not only passes our tests, but also avoids the dreaded Undefined Behavior (where the behavior is not constrained by the standard), but you get used to it. And all in all, being precise and specific when talking to a compiler is probably not a bad habit to get into, regardless of which language you program in.
However, every once in a while, people try to carry the same level of pedantry over into discussions about C++. In particular, a certain subset of C++ experts regularly complain that nearly every C++ programmer has their terminology mixed up. And that annoys me. If 99.9% of all C++ programmers use a term in one specific way, then even if it’s not supported by the ISO standard, perhaps we should just accept it. Yes, if you’re a compiler, it would introduce an ambiguity, but we’re not. We’re human beings, and we’re good at dealing with ambiguities. And while using the term correctly would theoretically eliminate any ambiguity, in practice it would cause a lot of it instead: today, we can guess with 99.9% certainty that people use the “incorrect” definition when they use the term. If we tried to make everyone use the term correctly, we’d be unable to guess at which meaning people actually intend to use.
The term in question is, of course, the STL. The Standard Template Library, developed by Stepanov in 1994, made available by SGI and finally adopted with some changes and some parts left out by the C++ standards committee into the C++ language in 1998.
Strictly speaking, the name “STL” refers to the SGI library (and, some would argue, to the language-agnostic idea for a library gradually developed by Stepanov before he implemented it in C++). Strictly speaking, the C++ standard makes no mention of a “Standard Template Library”. Strictly speaking, “STL” refers to a 15 year old library that no one would ever dream of using, because we’ve got an up-to-date near-copy in the C++ standard library. Strictly speaking, no one would ever want to use the name “STL” today.
And yet even C++ experts like Scott Meyers and Herb Sutter use the term incorrectly (unless we accept that Sutter offers courses in a 15-year old obsolete library rather than effective use of the C++ standard library)
And of course, the best part is that if we all were to start using the term correctly, we have nothing to replace it with. We don’t have another name for “the STL-derived parts of the C++ standard library”. We can say “the C++ standard library”, which, apart from being an extremely verbose name, also covers all the other parts of the standard library.
So really, is it worth it? What purpose does it serve to try to convince every C++ programmer in the world, to stop using the name “STL” to describe “the parts of the C++ standard library which look suspiciously like the STL”? We free up the name so we can use it to name a library that we virtually never need to mention. And we get to be wonderfully pedantic when talking about the C++ language, just like we already are when talking about C++ code. But we’ll also cause a lot of confusion, making it needlessly difficult to discuss one of the most commonly discussed areas of C++, because 1. it no longer has a simple name, and 2. when people use that name, we no longer have any idea what they’re referring to. They could be a “reformed” well-behaved C++ programmer, using it to refer, for some reason, to a library no one has used for the past 10 years, or they could be a rebellious troublemaker abusing the name to refer to a subset of the C++ standard library.
So, an appeal to all those C++ experts who think the world would be a better place if we all used the name STL correctly: stop it. Sit down, take a deep breath and accept and assume that the name is going to be used incorrectly by virtually everyone virtually all the time. Don’t pretend to be confused when people say “STL”, because you’re not. The ambiguity exists only on a theoretical level. In practice, no one ever wants to talk about the SGI library, and if they do, they will make it clear from context.





The issue is one of confusion. Which parts of the stdlib are in the STL? iostream? string? slist and others in the SGI STL, provided by some implementations, but not in the standard? Additions from TR1? What about 0x? Even though most people have very similar definitions, they are all slightly off from each other.
Why not just say “stdlib” if you mean the C++ Standard Library?
However, I sometimes do want to talk about the SGI library — or rather the ideas and idioms it made popular in C++, even if not the actual source code.
I actually read this!
[…] — [1] “When the STL Isn’t Enough: Adding Perl to Your C++ Applications”, Ken Fox, 1998 [2] C++ as defined by ISO/IEC 14882 – 1998 & ISO/IEC 14882 – 2003. [3] “STL, language lawyers and pedantry”, Jesper Alf Dam, 2010 […]
I liked this post. And completely agree with the thought and the last paragraph. I would also like to repeat : “Don’t pretend to be confused when people say “STL”, because you’re not.” Haha.