Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the C++ Standard Library part of the C++ Language?

Is the C++ Standard Library part of the C++ Language? (note "language", not "standard"; both are, of course, part of the standard).

If so, why? If not, why not?

The answer to this question may differ across C++98, C++03 and C++0x.

It's not subjective because it can be inferred from wording/requirements in the relevant standards documents.

like image 848
Lightness Races in Orbit Avatar asked Mar 28 '11 14:03

Lightness Races in Orbit


1 Answers

Yes, in both the current standard (C++03) and the new upcoming one (C++0x, which has at last reached the final draft stage so it shouldn't be too long now), the library functions are part of the specification (at least for the hosted implementations). Even freestanding implementations require a standard library, albeit a much simpler one.

In C++03, chapters 17 through 27 deal with the standard library. In C++0x (at least the n3225 draft which is the latest I have handy), chapters 17 through to 30 are relevant.

You can see the standards for C++03 and the current C++0x draft to confirm this. The standards contain both the language proper and the standard library.

From C++03 (which is pretty much the same as C++0x for this section):

1.1 Scope [intro.scope]

1 This International Standard specifies requirements for implementations of the C++ programming language. The first such requirement is that they implement the language, and so this International Standard also defines C++. Other requirements and relaxations of the first requirement appear at various places within this International Standard.

2 C++ is a general purpose programming language based on the C programming language as described in ISO/IEC 9899:1990 Programming languages – C (1.2). In addition to the facilities provided by C, C++ provides additional data types, classes, templates, exceptions, namespaces, inline functions, operator overloading, function name overloading, references, free store management operators, and additional library facilities.

So you can see from this that the standards authors do make a distinction between the language proper and the library but, for the implementors of the standard and users of the language, the language is the whole thing. You cannot call yourself C++ unless you follow the standard and the standard requires both the language proper and the library.

like image 63
paxdiablo Avatar answered Oct 27 '22 02:10

paxdiablo