home | C++ | FAQ | technical FAQ | publications | WG21 papers | TC++PL | Tour++ | Programming | D&E | bio | interviews | videos | quotes | applications | guidelines | compilers

Errata for 4th/14th printing of The C++ Programming Language

Errata for Bjarne Stroustrup: The C++ Programming Language (special edition), Addison-Wesley, 2000. ISBN0-201-70073-5. Errata for the 4th printing yielding the 5th printing. Also for the 14th printing of "The C++ Programming Language (3rd edition)" yielding the 15th printing.

Errors and Clarifications


Chapter 1:

Chapter 2:

Chapter 3:

Appendix B:

Chapter 4:

pg 77 Replace the 5th paragraph with: "An enumerator can be initialized by a constant-expression (C.5) of integral type (4.1.1). The range of an enumeration holds all the enumeration's enumerator values rounded up to the nearest larger binary power minus 1. The range goes down to 0 if the smallest enumerator is non-negative. If the smallest enumerator is negative, the range goes down to -(1+max) where max is the largests value in the positive part of the range. This defines the smallest bit-field capable of holding the enumerator values using the conventional two's complement representation. For example:"

Chapter 6:

pg 131 s/removing const qualifiers/removing const and volatile qualifiers/

Chapter 11:

pg 280 Improved version of 4th paragraph: "Thus, a friend function should be explicitly declared in an enclosing scope or take an argument of its class or a class derived from that (13.6). If not, the friend cannot be called. For example:"

pg 284 s/string initialized (using copy constructor)/string initialized (using constructor)/

pg 293 better:

	class String {
		struct Srep;			// representation
		Srep *rep;

		class Cref;			// reference to char
	public:

Chapter 15:

pg 401 add as the last sentence before 15.2.5.1: "A potential problem is that now a BB_popup_ival_slider can't be implicitly converted to an Ival_slider."

pg 414 replace the first paragraph with: "It is not possible to cast to a private base class, and ``casting away const '' (or volatile) requires a const_cast (6.2.7). Even then, using the result is safe only provided the object wasn't originally declared const (or volatile) (10.2.7.1)."

pg 415 Replace the second paragraph with: "If the value of a pointer or a reference operand of a polymorphic type is 0, typeid() throws a bad_typeid exception. If the operand of typeid() has a non-polymorphic type or is not an lvalue, the result is determined at compile time without evaluating the operand expression."

Chapter 16:

pg 431 Replace the paragraph before for the table by "A standard header with a name starting with the letter c is equivalent to a header in the C standard library. For every header <X.h> defining part of the C standard library in the global namespace and also in namespace std, there is a header <cX> defining the same names in the std namespace only (see 9.2.2)."

Chapter 19:

pg 563 s/d< curr-c->begin()/d< -(curr-c->begin())/ twice

Chapter 21:

pg 623 replace the handler by

	catch(ios_base::failure) {	// ok: end of file reached
		break;
	}

Appendix A:

pg 811 s/indentifier(opt) = template-name/indentifier(opt) = id-expression/

pg 811 in "template-argument:" s/template-name/id-expression/

Appendix C:

pg 851 replace the first example by

	void Z2::f(Y1* py1, Y2* py2, Y3* py3)
	{
		X* px = py1;	// ok: X is a public base class of Y1
		py1->a = 7;	// ok
		px = this;		// ok: X is a protected base of Y2, and Z2 is derived from Y2
		a = 7;		// ok
		px = py2;		// error: X is a protected base of Y2, and Z2 is derived from Y2,
					// but we don't know that py2 is a Z2 or how Y2::X is used in a non-Z2 object
		py2->a = 7;	// error: Z2 doesn't know how Y2::a is used in a non-Z2 object
		px = py3;		// error: X is a private base of Y3
		py3->a = 7;	// error
	}

Appendix D:

Appendix E:

pg 944 change

	void destroy_elements() { for (T* p = v; p!=space; ++p) p->~T(); }
to
	void destroy_elements() { for (T* p = v; p!=space; ++p) p->~T(); space=v; }


Typos


Chapter 10:

pg 229 s/The keyword static is not be repeated/The keyword static is not repeated/

Chapter 21:

pg 652 s/pecision/precision/

pg 685 s/miniscule propability/minuscule probability/

home | C++ | FAQ | technical FAQ | publications | WG21 papers | TC++PL | Tour++ | Programming | D&E | bio | interviews | videos | quotes | applications | guidelines | compilers