Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!att!kaiser!stan From: stan@kaiser.UUCP (s Lippman) Newsgroups: comp.lang.c++ Subject: errata in C++ Primer Message-ID: <883@kaiser.UUCP> Date: 19 Jun 89 16:15:16 GMT Organization: AT&T Bell Laboratories, Liberty Corner Lines: 67 My ``C++ Primer'' is based on a draft of Bjarne's C++ Reference Manual (and matching in-house pre- release versions Release 2.0). Subsequent to the delivery of the manuscript a review of the language definition resulted in a few modifications. This impacts the book as follows: p.24 : the keyword ``handle'' is now replaced with the keyword ``catch'' (also page 430). p.40 : named enumerations now define unique integral types. For example, enum TestStatus { NOT_RUN=-1, FAIL, PASS }; enum Boolean { FALSE, TRUE }; main() { TestStatus test = NOT_RUN; Boolean found = FALSE; test = -1; // error: TestStatus = int test = 10; // error: TestStatus = int test = found; // error: TestStatus = Boolean test = FALSE; // error: TestStatus = const Boolean int st = test; // ok: implicit conversion } for compatibility with prior releases, the 2.0 implementation issues warnings rather than errors. p. 159: Overloaded functions can now be distinquished by arguments of an enumeration type. For example, enum Bool { FALSE, TRUE } found; enum Stat { FAIL, PASS }; extern void ff( Bool ); extern void ff( Stat ); extern void ff( int ); ff( PASS ); // ff( Stat ) ff( 0 ); // ff( int ) ff( found ); // ff( Bool ) p. 264-265: Class instances of operator new and operator delete should define arguments of type ``size_t'' rather than of type long. As Andy Koenig pointed out in a discussion of these operators, the current 2.0 implementation accepts the long argument and replaces it with that of size_t. The class instance of operator delete must define a return type of void. (There was a brief window when it was permitted to define an arbitrary return type -- this section was completed during this window.) p. 354 : A virtual function invoked within either the constructor OR destructor of a base class is resolved statically to the instance defined by the base class. (Thanks to Andy Koenig for pointing out the destructor case.) These corrections will be reflected in a subsequent reprinting of the book. Stan Lippman AT&T Bell Laboratories