NOTE ON THE SECOND PRINTING | All the corrections listed below prior to April 1, 2005 have been incorporated in the second printing that was released by the publisher in the middle of June 2005. |
---|
If you have purchased a copy of the second printing of the book, only the tables with blue border apply to you.
Page ix of Table of Contents:
(fixed in the second printing of the book) |
|
---|---|
The entries for Sections 5.1.1.1, 5.1.1.2, and 5.1.1.3 should be indented to the right. As currently printed, they are indented to the left. |
Page 3: Line 14 of the second paragraph
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | example, polymorphism can only be invoked through pointers, a fact that can have a |
corrected version: | example, polymorphism can only be invoked through pointers and references, a fact that can have a |
Page 8: Line 4 of the first paragraph below the code | |
---|---|
line as currently set: | to the standard output stream, which would generally be directed to the window |
corrected version: | to the standard output, which would generally be directed to the window |
Page 13: Line 5 of the last complete paragraph
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
the Java compiler. println() is a method defined for the class OutputStream . One
|
corrected version: | the Java compiler. One |
Page 18: Third line from the top of the page | |
---|---|
line as currently set: |
&& ch != ’\n’ )
|
corrected version: |
&& ch != ’\n’ && ch != ’\r’ )
|
NOTE: The program TermIO.java as shown in the book works fine on Unix and Linux machines, but will run into the 'line terminator problem' on Windows and Mac machines. The correction shown here, along with the correction shown next, should make the program work on all platforms. |
Page 18: Fifth line from the top of the page | |
---|---|
line as currently set: |
if ( ch == ’\n’ ) newline = true;
|
corrected version: |
if ( ch == ’\n’ || ch == ’\r’ ) newline = true;
|
NOTE: The program TermIO.java as shown in the book works fine on Unix and Linux machines, but will run into the 'line terminator problem' on Windows and Mac machines. The correction shown here, along with the previous correction, should make the program work on all platforms. |
Page 21: The beginning section of the program FileCopy.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <fstream>
|
corrected version: |
#include <iostream>
|
Page 21: The code line labeled //(C) in the middle of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
void print_error(const char*, const char* = " "); //(C)
|
corrected version: |
void print_error(const char*, const char* = ""); //(C)
|
Page 22: Last line of the first paragraph
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
in the header fstream are defined in the namespace std .
|
corrected version: |
in the included header files are defined in the namespace std .
|
Page 22: First line of the last paragraph
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | The actual file-to-file copy takes place in lines (H) and (I). In line (G), the function |
corrected version: | The actual file-to-file copy takes place in lines (H) and (I). In line (H), the function |
Page 22: First line of the footnote 17 at the bottom of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
The fstream header file includes the iostream header file. See Chapter 6 for the C++ iostream
|
corrected version: |
The program shown also includes the iostream header file for cerr . See Chapter 6 for the C++ stream
|
Page 22: The first two lines of the footnote 20 at the bottom of the page
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
The classes ifstream and ofstream are subclasses of the class iostream . They inherit all the
public attributes of the parent class iostream and in addition have their own specailized attributes for file
|
corrected version: |
The class ifstream is a subclass of istream and the class ofstream is a subclass of ostream . They inherit all the
public attributes of the parent classes and in addition have their own specialized attributes for file
|
Page 24: The code line beginning with java in the bottom half of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | java fileIODemo sourceFile destinationFile |
corrected version: | java FileCopy sourceFile destinationFile |
Page 24: Second line after the previous correction
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | and args[1] to destFile. |
corrected version: | and args[1] to destinationFile. |
Page 25: The paragraph that begins with "The basic reference for C++ ...."
(fixed in the second printing of the book) |
|
---|---|
Switch the first two sentences of the paragraph that begins with the phrase "The basic reference for C++ is the book by......". As currently set, a reader may mistakenly believe that the phrase "Chapters 6 and 10 of this book" in the second sentence refers to the Stroustrup reference of the first sentence. |
Page 29: Line 2 of the first paragraph
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | of that knowledge. The following words/phrases represent the concepts that are most |
corrected version: | of that knowledge. The following words represent the concepts that are most |
Page 32: Line 4 of the paragraph that begins with "So, in a nutshell,..." in the middle of the page | |
---|---|
line as currently set: | in different class and for automatic invocation of object-specific definitions of such |
corrected version: | in different classes and for automatic invocation of object-specific definitions of such |
Page 36: Line 4 of the last paragraph
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | below the constructor now uses the member initialization syntax for the initialization |
corrected version: | the constructor now uses the member initialization syntax for the initialization |
Page 42: Line 6 of the code
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
void print() { cout << ``Name: '' << name << " Age: " << age; }
|
corrected version: |
void print() { cout << "Name: " << name << " Age: " << age; }
|
Page 43: Line 4 from the bottom
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
and then if we invoke the print() function for uptr by
|
corrected version: |
and then if we invoke the print() function on this StudentUser object by
|
Page 43: Last line on the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
Zaphlet 10 cosmology
|
corrected version: |
Name: Zaphlet Age: 10 School Enrolled: cosmology
|
Page 44: Line 4 of the first complete paragraph
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
for a StudentUser object. No, not at all. As far as a StudentUser object is
|
corrected version: |
for a StudentUser object? No, not at all. As far as a StudentUser object is
|
Page 46: Line 4 from the top
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | users[0] and users[1] and on the pointer users[1] after it is cast down to be of |
corrected version: | users[0] and users[2] and on the pointer users[1] after it is cast down to be of |
Page 53: The function definition that starts in the code line labeled '//(C)' in the bottom third of the page
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
friend ostream& operator<<(ostream& os, const User& user) { //(C)
|
corrected version: |
friend ostream& operator<<(ostream& os, const User& user) { //(C)
|
Page 56: Fourth line from the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
public class Test {
|
corrected version: |
class Test {
|
Page 66: Name of the program near the bottom of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
//Namespaces.cc
|
corrected version: |
//Namespace4.cc
|
Page 72: Source code line labeled //(B) in the bottom third of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
friend Y;
|
corrected version: |
friend class Y;
|
Page 79: Third line from the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | Our discussion so far on object comparison has been centered primarily on a |
corrected version: | Our discussion so far on object comparison has centered primarily on a |
Page 79: Fifth line from the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | values of one or more the data members of the objects. Java adds an additional twist |
corrected version: | values of one or more data members of the objects. Java adds an additional twist |
Page 79: First line of the third paragraph
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | In Java, comparison of two objects on the basis of equality of reference is carried |
corrected version: | In Java, a comparison of two objects on the basis of equality of reference is carried |
Page 118: The beginning section of the program Qsort.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <string>
|
corrected version: |
#include <iostream>
|
Page 119: Code line labeled //(B) in the middle of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
string1.append( string2, 3, 6 ); //(B)
|
corrected version: |
string1.append( string2, 4, 6 ); //(B)
|
Page 121: Program output shown and text at the top
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
4 32 one armadillo is like any other armadillo where the numbers 4 and 32 are the position indices where the substring "hello" occurs in the larger string "one hello is like any other hello". Here is the program: |
corrected version: |
one armadillo is like any other armadillo Here is the program: |
Page 121: The beginning section of the program StringFind.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <string>
|
corrected version: |
#include <iostream>
|
Page 121: Last line in the body of the while loop of the program StringFind.cc
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
pos++;
|
corrected version: |
pos += replaceString.size();
|
Page 122: Last line of the first paragraph of Section 4.3.6
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | (B) is "Fiction has to make sense. - Tom Clancy" |
corrected version: | (A) is "Fiction has to make sense. - Tom Clancy" |
Page 125: The beginning section of the program StringSize.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <iostream>
|
corrected version: |
#include <iostream>
|
Page 127: The beginning section of the program StringSizeOf.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <iostream>
|
corrected version: |
#include <iostream>
|
Page 128: The beginning section of the program ArraySizeOf.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <iostream>
|
corrected version: |
#include <iostream>
|
Page 133: Line 3 from the top
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
string. If we invoke the StringBuffer with an int argument, it constructs a string
|
corrected version: |
string. If we invoke the StringBuffer constructor with an int argument, it constructs a string
|
Page 133: Line 4 from the top
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | buffer with no characters in, but a capacity as specified by the argument. So the |
corrected version: | buffer with no characters in it, but with a capacity as specified by the argument. So the |
Page 137: Source code for the StringSort.java program
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
System.out.println("Case sensitive sort with Arrays.sort:" );
|
corrected version: |
System.out.println("Case sensitive sort:" );
|
Page 141: The first line at the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
int n = str.lastIndxOf( "he" ); //7
|
corrected version: |
int n = str.lastIndexOf( "he" ); //7
|
Page 142: Third line from the top
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
stands for the ending index of the desired substring. In all cases, for both String
|
corrected version: |
stands for the ending index of the desired substring plus one. In all cases, for both String
|
Page 142: Code lines containing "56789" in the upper third of the page
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
System.out.println( str.substring( 5, 9 ) ); // "56789"
System.out.println( stb.substring( 5, 9 ) ); // "56789" |
corrected versions of these two lines: |
System.out.println( str.substring( 5, 9 ) ); // "5678"
System.out.println( stb.substring( 5, 9 ) ); // "5678" |
Page 148: First line at the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | of linked lists come at a price. First, insertion of new elements and removal of existing |
corrected version: | of linked lists comes at a price. First, insertion of new elements and removal of existing |
Page 157: The line before the last line of the large middle paragraph
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
back() functions. Line (F) shows how a vector iterator can be initialized to point
|
corrected version: |
back() functions. Line (G) shows how a vector iterator can be initialized to point
|
Page 157: The beginning section of the program named VectorFrontBackResize.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <iostream>
|
corrected version: |
#include <iostream>
|
Page 158: Indentation of the second code line from the top of the page
(fixed in the second printing of the book) |
|
---|---|
the first two lines as currently set: |
while ( p != vec.end() ) result += *p++;
|
corrected version: |
while ( p != vec.end() ) result += *p++;
|
Page 160: Line 7 from the top
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
insert . When we dereference the previously initialized iterator again in line (D), we
|
corrected version: |
insert . When we dereference the previously initialized iterator again in line (E), we
|
Page 168: The beginning section of the program DequeFront.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <string>
|
corrected version: |
#include <iostream>
|
Page 169: The line after the
code line labeled "//(I)"
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
print(animals); // canray yak
|
corrected version: |
print(animals); // canary yak
|
Page 171: The beginning section of the program ListOps.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <string>
|
corrected version: |
#include <iostream>
|
Page 174: The beginning section of the program StackOps.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <string>
|
corrected version: |
#include <iostream>
|
Page 175: The beginning section of the program QueueOps.cc at the bottom of the page
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
//QueueOps.cc
|
corrected version: |
//QueueOps.cc
|
Page 177: The beginning section of the program PriorityQueueOps.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <string>
|
corrected version: |
#include <iostream>
|
Page 179: The beginning section of the program MapHist.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <string>
|
corrected version: |
#include <iostream>
|
Page 181: The beginning section of the program SetOps.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <string>
|
corrected version: |
#include <iostream>
|
Page 202: The beginning section of the computer program named VectorDest.cc in the bottom third of the page (fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <iostream>
|
corrected version: |
#include <iostream>
|
Page 203: The beginning section of the computer program named VectorDestOrder.cc in the bottom fifth of the page (fixed in the second printing of the book) |
|
---|---|
line as currently set: |
#include <iostream>
|
corrected version: |
#include <iostream>
|
Page 204: The beginning section of the computer program for Problem 4 in the bottom half of the page (fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <iostream>
|
corrected version: |
#include <iostream>
|
Page 208: footnote
(fixed in the second printing of the book) |
|
---|---|
footnote number as currently displayed: | 2324 |
corrected version: | 23 |
Page 232: The beginning section of the program ExplicitCast1.cc
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
#include <iostream.h>
|
corrected version: |
#include <iostream>
|
Page 233: The beginning section of the program ExplicitCast2.cc
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
#include <iostream>
|
corrected version: |
#include <iostream>
|
Page 233: Last line on the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | 1000000 00000000 |
corrected version: | 10000000 00000000 |
Page 240: The beginning section of the program TestFilePosition.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <fstream>
|
corrected version: |
#include <iostream>
|
Page 241: The beginning section of the program TestFilePosition2.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <fstream>
|
corrected version: |
#include <iostream>
|
Page 243: Lines 5 and 6 from the bottom of the page
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
fail() returns true when either bad() returns true or when eof() evaluatesto false. Finally, the function good() returns true as long as the stream has
|
corrected version: |
fail() returns true when either bad() returns true or because the requestedoperation has failed for formatting reasons (as, for example, when a letter is encountered while trying to read an integer). Finally, the function good() returns true as long as the stream has |
Page 245: The beginning section of the program GetThirdType.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <fstream>
|
corrected version: |
#include <iostream>
|
Page 245: Lines 5 and 6 from the bottom of the page | |
---|---|
lines as currently set: |
The additional functions introduced here, getline, gcount(), and ignore() ,all return the istream object on which they are invoked.
|
corrected version: |
Of the additional functions introduced here, getline() and ignore() return the istream object on which they are invoked, and gcount() returns the number of bytes just read.
|
Page 247: The beginning section of the program BinaryFileIO.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <fstream>
|
corrected version: |
#include <iostream>
|
Page 248: The beginning section of the program BinaryFileIO2.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <fstream>
|
corrected version: |
#include <iostream>
|
Page 250: The beginning section of the program WriteBinaryIntsToFile.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <fstream>
|
corrected version: |
#include <iostream>
|
Page 250: Line labeled //(B) in the program WriteBinaryIntsToFile.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
out.write( data, sizeof( data ) );
|
corrected version: |
out.write( (char*) data, sizeof( data ) );
|
Page 250: Line that begins with the word 'array' in the bottom third of the page | |
---|---|
line as currently set: | array, the next four bytes of the next integer, and so on. However, if run the same |
corrected version: | array, the next four bytes of the next integer, and so on. However, if we run the same |
Page 251: The beginning section of the program BinaryFileIO3.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <fstream>
|
corrected version: |
#include <iostream>
|
Page 251: Line labeled //(C) in the program BinaryFileIO3.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
out.write( data, sizeof( data ) );
|
corrected version: |
out.write( (char*) data, sizeof( data ) );
|
Page 251: Line labeled //(I) in the program BinaryFileIO3.cc(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
in.read( buffer, size );
|
corrected version: |
in.read( (char*) buffer, size );
|
Page 256: The beginning section of the program Skipws.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <fstream>
|
corrected version: |
#include <iostream>
|
Page 257: Second line of the last code example near the bottom of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
ofstream from( "textfile" );
|
corrected version: |
ifstream from( "textfile" );
|
Page 262: Botched-up line (second line of text)
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | unreadable because of overprinting |
corrected version: |
of each file in hex, and what the output looks like if read in text mode. The program starts out by declaring and initializing the int in line (A). Our first
|
Page 279: Line 9 of Homework Problem 10
(fixed in the second printing of the book) |
|
---|---|
(Note that this correction is for the second occurrence of object serialization in that paragraph.) |
Page 293: Line 5 from the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
const n = 100; // WRONG
|
corrected version: |
const int n = 100; // WRONG
|
Page 297: First line of the last paragraph
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | Pointers and, as we will be discussed in the next section, arrays of pointers play |
corrected version: | Pointers and, as will be discussed in the next section, arrays of pointers play |
Page 299: Line labeled //(C) in the middle of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | Person peson1( "John Doe", "Main Street USA" ); //(C) |
corrected version: | Person person1( "John Doe", "Main Street USA" ); //(C) |
Page 302: Line 10 from the bottom of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
int x, y, v[10]; in C++ or Java
|
corrected version: |
int x, y, v[10]; in C++
|
Page 307: The second text line after the last code line on the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | entity as long it is of the same type, an array name cannot be made to point to some |
corrected version: | entity as long as it is of the same type, an array name cannot be made to point to some |
Page 312: Line 3 of the paragraph that begins with "On the other hand,"
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
character (\u000) for arrays for char s, to 0.0f for floating point arrays, to 0.0 for
|
corrected version: |
character (\u000) for arrays of char s, to 0.0f for floating point arrays, to 0.0 for
|
Page 313: The second line from the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | objects is first created in Java, each element is default-initialized to a hold the null |
corrected version: | objects is first created in Java, each element is default-initialized to hold the null |
Page 315: Sixth line from the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | cessing. The methods provided can be divided into the following four categories: |
corrected version: | cessing. The methods provided can be divided into the following three categories: |
Page 315: Line 8 of the paragraph that begins with the header "sort methods:" in the bottom half of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | class-type objects is whether the object that are deemed to be equal according |
corrected version: | class-type objects is whether the objects that are deemed to be equal according |
Page 321: The second text line in the second paragraph after the code
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
error since the symbolic constant light in not in scope in main() . As we mentioned
|
corrected version: |
error since the symbolic constant light is not in scope in main() . As we mentioned
|
Page 321: First line of the next to the last paragraph
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | On the other hand, the statements in lines (J) and (L) that involve the symbolic |
corrected version: | On the other hand, the statements in lines (J) and (M) that involve the symbolic |
Page 321: Second line of the next to the last paragraph
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
constants c1 and h are legal since these symbolic constants were introduced through
|
corrected version: |
constants c1 and tall are legal since these symbolic constants were introduced through
|
Page 323: The beginning section of the program EnumWithLabelArray.cc
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
#include <string>
|
corrected version: |
#include <string>
|
Page 324: Just above the long horizontal straight line in the middle of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
retrun 0;
|
corrected version: |
return 0;
|
Page 325: Statement of Homework Problem 5 near the bottom of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | Will C++ this program compile and execute? |
corrected version: | Will this C++ program compile and execute? |
Page 335: Line labeled //(A) in the middle of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | User u = new User( ` `Zygot' ', 38 ); //(A) |
corrected version: | User u = new User( "Zygot", 38 ); //(A) |
Page 343: The header of the for loop
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
for ( int i = 0; i < 3 * wideth * height; i++ )
|
corrected version: |
for ( int i = 0; i < 3 * width * height; i++ )
|
Page 346: Line 2 of footnote 1 near the bottom of the page.
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | in Chapter 7. |
corrected version: | in Chapter 6. |
Page 359: First line at the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
object y in main going to be the same as what was the local object usr inside f or a
|
corrected version: |
object supplied as the initializer to y in main going to be the same as what was the local object usr inside f or a
|
Page 364: Last line of the third paragraph
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | following will code fragment is wrong: |
corrected version: | following code fragment is wrong: |
Page 371: The program output line after the code example in the middle of the page.
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
from g(double): x is 1
|
corrected version: |
g(double): x is 1
|
Page 372: Line 9 from the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | for overload resolution in Java. There are reproduced here from [2]. |
corrected version: | for overload resolution in Java. These are reproduced here from [2]. |
Page 376: The beginning section of the program Silly.cc in the middle of the page
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <iostream>
|
corrected version: |
#include <iostream>
|
Page 382: Second line of Homework Problem 8 | |
---|---|
line as currently set: |
Overload.java of Section 9.12. In the program of Section 9.12, the first call to
|
corrected version: |
Overload.java of Section 9.11. In the program of Section 9.11, the first call to
|
Page 397: The beginning section of the program ExceptionUsage7.cc in the upper third of the page (fixed in the second printing of the book) |
|
---|---|
line as currently set: |
#include <iostream>
|
corrected version: |
#include <iostream>
|
Page 397: The beginning section of the program ExceptionUsage8.cc in the bottom third of the page (fixed in the second printing of the book) |
|
---|---|
line as currently set: |
#include <iostream>
|
corrected version: |
#include <iostream>
|
Page 398: The beginning section of the program ExceptionUsage9.cc in the middle third of the page (fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <iostream>
|
corrected version: |
#include <iostream>
|
Page 399: First line of item 2 in the middle of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | If a function is written so as to throw an exception, that fact must be declared |
corrected version: | If a Java function is written so as to throw an exception, that fact must be declared |
Page 399: Last line of item 2
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | new for constructing an object of type MyException. |
corrected version: |
new for constructing an object of type MyException. It is not mandatory in C++ to include a function's exception specification in the header of the function. |
Page 399: First line of item 3 near the bottom of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | An exception-throwing function can only be invoked in one of the following |
corrected version: | An exception-throwing function in Java can only be invoked in one of the following |
Page 400: Third line of item 4 in the upper third of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | words, one now has no choice but to say |
corrected version: | words, in Java one has no choice but to say |
Page 410: Line that begins with "to be used for a new Java class ...." above the middle of the page | |
---|---|
line as currently set: |
to be used for a new Java class, FileIO with the static methods listed below.
|
corrected version: |
to be used for a new Java class FileIO with the static methods listed below.
|
Page 410: Second line of the code block in the lower half of the page | |
---|---|
line as currently set: |
throws File IOException
|
corrected version: |
throws FileIOException
|
Page 419: The beginning section of the program NoArgMissing.cc near the top of the page (fixed in the second printing of the book) |
|
---|---|
line as currently set: |
#include <vector>
|
corrected version: |
#include <vector>
|
Page 427: Third line from the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
Finally, note that in line (C) the data member today is of the same type as the class
|
corrected version: |
Finally, note that in line (A) the data member today is of the same type as the class
|
Page 443: The three lines of program output shown in the bottom half of the page.
(fixed in the second printing of the book) |
|
---|---|
code lines as currently set: |
GameScore object destroyed 35 vs. 7
GameScore object destroyed 28 vs. 3
GameScore object destroyed 29 vs. 0
|
corrected version: |
GameScore object destroyed 29 vs. 0
GameScore object destroyed 35 vs. 7
GameScore object destroyed 28 vs. 3
|
Page 478: Line 14 from the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
cout << *p++ << " ";
|
corrected version: |
os << *p++ << " ";
|
Page 478: Line 21 from the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
cout << q→first << ": " << q→second << " ";
|
corrected version: |
os << q→first << ": " << q→second << " ";
|
Page 505: Source code line that starts with friend in the middle of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
friend ostream& operator<< ( ostream&, MyComplex& );
|
corrected version: |
friend ostream& operator<< ( ostream&, const MyComplex& );
|
Page 511: The code line immediately after the line labeled //(A)
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
return ( i >= 0 && i <= length ) ? true: false;
|
corrected version: |
return ( i >= 0 && i <= length && length != 0 ) ? true: false;
|
Page 514: Overloading of the input operator near the top of the page | |
---|---|
lines as currently set: |
istream& operator>> ( istream& is, MyString& str ) {
|
corrected version: |
istream& operator>> ( istream& is, MyString& str ) {
|
Page 515: Definition of constructor in lines 3 through 7 from the top of the page | |
---|---|
lines as currently set: |
MyString( const char* ch ) {
|
corrected version: |
MyString( const char* ch ) {
|
Page 515: Definition of copy constructor in lines 15 through 19 from the top of the page | |
---|---|
lines as currently set: |
MyString( const MyString& str ) {
|
corrected version: |
MyString( const MyString& str ) {
|
Page 517: Overloading of the output operator | |
---|---|
lines as currently set: |
ostream& operator<< ( ostream& os, const MyString& str ) {
|
corrected version: |
ostream& operator<< ( ostream& os, const MyString& str ) {
|
Page 517: Overloading of the input operator | |
---|---|
lines as currently set: |
istream& operator>> ( istream& is, MyString& str ) {
|
corrected version: |
istream& operator>> ( istream& is, MyString& str ) {
|
Page 525: Line 7 from the bottom of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
SmartPtr operator=( SmartPtr& other ) {
|
corrected version: |
SmartPtr& operator=( SmartPtr& other ) {
|
Page 526: Code line labeled //(A)
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
explicit SmartPtr( X* p = 0 ) : ptr( p ) {};
|
corrected version: |
explicit SmartPtr( X* p = 0 ) : ptr( p ) {}
|
Page 526: Line 10 from the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
SmartPtr operator=( SmartPtr& other ) {
|
corrected version: |
SmartPtr& operator=( SmartPtr& other ) {
|
Page 527: The first line of the assignment operator overload definition in the middle of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
SmartPtr operator=( SmartPtr<T>& other ) {
|
corrected version: |
SmartPtr& operator=( SmartPtr<T>& other ) {
|
Page 534: Line 2 of the second complete paragraph | |
---|---|
line as currently set: | code below, the former for designated a point in 3D xyz space, and the latter a point in |
corrected version: | code below, the former for designating a point in 3D xyz space, and the latter a point in |
Page 536: Seventh line from the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
friend Point3D;
|
corrected version: |
friend class Point3D;
|
Page 537: Line 11 from the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
friend Point3D;
|
corrected version: |
friend class Point3D;
|
Page 538: Line 2 of the footnote
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | ThresholdCheck defined in Problem 4 of the homework section of Chapter 5. |
corrected version: | ThresholdCheck defined in Problem 6 of the homework section of Chapter 5. |
Page 539: The beginning section of the program SortWithFunctor.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <string>
|
corrected version: |
#include <iostream>
|
Click here to see a better implementation of SortWithFunctor.cc
What is ugly about the implementation shown in the first printing of the book is that the templatized print function accesses the data members of the Cat class. The second printing of the book includes the improved version. |
Page 540: The first line after the code line labeled //(B)
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
print( kittyList ); // cuddles 3 socks 6 tabby 6
|
corrected version: |
print( kittyList ); // cuddles 3 socks 6 tabby 8
|
Page 540: Ninth line from the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
typedef list<T>::const_iterator CI;
|
corrected version: |
typedef typename list<T>::const_iterator CI;
|
Page 541: The beginning section of the program SortWithLessThan.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <string>
|
corrected version: |
#include <iostream>
|
Click here to see a better implementation of SortWithLessThan.cc
What is ugly about the implementation shown in the first printing of the book is that the templatized print function accesses the data members of the Cat class. The second printing of the book includes the improved version. |
Page 541: Sixth line from the bottom of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
typedef list<T>::const_iterator CI;
|
corrected version: |
typedef typename list<T>::const_iterator CI;
|
Page 542: The beginning section of the program SortPointerTypes.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <string>
|
corrected version: |
#include <iostream>
|
Click here to see a better implementation of SortPointerTypes.cc
What is ugly about the implementation shown in the first printing of the book is that the templatized print function accesses the data members of the Cat class. The second printing of the book includes the improved version. |
Page 543: Code line in the middle of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
typedef vector<T>::const_iterator CI;
|
corrected version: |
typedef typename vector<T>::const_iterator CI;
|
Page 558: The third, the fourth, and the fifth lines from the bottom of the page
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
friend ostream& operator<<( ostream& os, const X& xobj ) {
|
corrected version: |
friend ostream& operator<<( ostream& os, const X& xobj ) {
|
Page 561: The beginning section of the program LinkedListSpecialized.cc
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <iostream>
|
corrected version: |
#include <iostream>
|
Page 563: Lines 2, 3, and 4 from the top of the page
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
template <class T> is now missing from the header of the class definition. How-ever, if we so wanted, we could have used the prefix template <> and defined thespecialization as |
corrected version: |
template <class T> is now replaced by template <> in the explicit specialization.Therefore when the compiler sees the following |
Page 563: Eighth line from the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | Although we do not need the prefix any more, the compiler knows that this specializa- |
corrected version: | it knows that this specializa- |
Page 563: First line of the third paragraph
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
For the same reason we did not need the prefix template<class T> for the class
|
corrected version: |
Unlike the prefix template<> for the class
|
Page 565: Fourth line from the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
Buffer<> buf1; // a string buffer of size 128
|
corrected version: |
Buffer<> buff1; // a string buffer of size 128
|
Page 601: Fourth line from the bottom of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | of which is responsible for a locating a particular landmark from a list of landmarks |
corrected version: | of which is responsible for locating a particular landmark from a list of landmarks |
Page 647: The beginning section of the program StaticBinding.cc in the top third of the page (fixed in the second printing of the book) |
|
---|---|
line as currently set: |
//StaticBinding.cc
|
corrected version: |
//StaticBinding.cc
|
Page 648: Line 6 from the bottom of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
virtual f5();
|
corrected version: |
virtual void f5();
|
Page 724: Line 15 from the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
Assemble( Part1* p1, Part* p2,
|
corrected version: |
Assemble( Part* p1, Part* p2,
|
Page 724: Fifth line from the bottom of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
AssembleWithRobot( Part1* p1, Part* p2,
|
corrected version: |
AssembleWithRobot( Part* p1, Part* p2,
|
Page 726: Line 10 from the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
Assemble( Part1* p1, Part* p2,
|
corrected version: |
Assemble( Part* p1, Part* p2,
|
Page 727: Fifth line from the bottom of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
AssembleWithRobot( Part1* p1, Part* p2,
|
corrected version: |
AssembleWithRobot( Part* p1, Part* p2,
|
Page 736: Third line from the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | is it to create the the shared X subobject? The answer to this question is supplied by |
corrected version: | is it to create the shared X subobject? The answer to this question is supplied by |
Page 736: Lines 13, 15, and 23 from the top of the page
(fixed in the second printing of the book) |
|
---|---|
Replace the three occurrences of the symbol uppercase W by the symbol uppercase Z. |
Page 744: The beginning section of the program DuplicateBase.cc near the top of the page (fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <iostream.h>
|
corrected version: |
#include <iostream>
|
Page 776: Insert a new one-line function definition in the bottom half of the page
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
}
|
corrected version: |
}
|
Page 860: Line 3 of the code example
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | //inconsequential made by the author |
corrected version: | //inconsequential changes made by the author |
Page 890: In the top one-third of the page
(fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include "WindowWithMenu.h"
|
corrected version: |
#include "WindowWithMenu.h"
|
Page 912: Fourth line from the bottom of the page | |
---|---|
line as currently set: |
if ( g2d == null ) g2d = (Graphics2D) g;
|
corrected version: |
g2d = (Graphics2D) g;
|
Page 932: Second line of the second paragraph
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
GDK_BUTTON_PRESS and GTK_2BUTTON_PRESS since, like in the earlier Qt program,
|
corrected version: |
GDK_BUTTON_PRESS and GDK_2BUTTON_PRESS since, like in the earlier Qt program,
|
Page 934: Indentation of the seventh line from the bottom of the page
(fixed in the second printing of the book) |
|
---|---|
The sixth, seventh, and the eighth lines from the bottom of the page as currently set: |
} return(TRUE); } |
corrected version: |
} return(TRUE); } |
Page 938: Line 3 of the first paragraph
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | with a number of attributes, some of which are mandatory and other optional, the |
corrected version: | with a number of attributes, some of which are mandatory and others optional; the |
Page 941: Lines 8 and 9 from the bottom of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
is carried out by the loadImages method, defined in the program at line (O). Notehow this method is run in a separate thread in init in line (M):
|
corrected version: |
is carried out by the loadImages method, defined in the program at line (L). Notehow this method is run in a separate thread in init in line (J):
|
Page 942: Fourth line from the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
ages, as opposed to the Image class. As was mentioned earlier in Section 17.9, the
|
corrected version: |
ages, as opposed to the Image class. As was mentioned earlier in Section 17.19, the
|
Page 947: The blank line after line 4 of the HTML code at the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | blank line |
corrected version: | </head> |
Page 955: Indentation of the sixth line from the bottom of the page
(fixed in the second printing of the book) |
|
---|---|
The Fifth, sixth, and the seventh lines from the bottom of the page as currently set: |
} i++; } |
corrected version: |
} i++; } |
Page 970: Sixth bulleted item in the middle of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | • blocked |
corrected version: | • blocking |
Page 973
(fixed in the second printing of the book) |
|
---|---|
Delete the implementation of the keepBusy() function for the class RepeatedSwaps. Please do NOT delete this function at the top of the page. It is the repeat definition of this function in the middle of the page that is unnecessary. |
Page 975: Line 13 from the top
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
result moved back to dataItem1 will not correspond to thread1 but to thread2.
|
corrected version: |
result moved back to dataItem2 will not correspond to thread1 but to thread2.
|
Page 990: Second line of the first paragraph of Section 18.8
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | is to construct an applet that loads in a sequence of images sufficiently rapidly so that |
corrected version: | is to construct an applet that displays a sequence of images sufficiently rapidly so that |
Page 990: Third line of the second paragraph of Section 18.8
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | ecutive shots of a bird in flight. We wish to create a thread that would load and |
corrected version: | ecutive shots of a bird in flight. We wish to create a thread that would |
Page 1002: Fourth line from the top of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | suppose to alter the state of the GUI after finishing some time-consuming operation, |
corrected version: | supposed to alter the state of the GUI after finishing some time-consuming operation, |
Page 1002: First line of the new paragraph in the middle of the page
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
The main library for POSIX threads in C is pthreads.h . It defines a data type
|
corrected version: |
The main header file for POSIX threads in C is pthreads.h . It defines a data type
|
Page 1027: Second line of the first paragraph
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | in the client-server model. Today it is probably the most commonly used model |
corrected version: | on the client-server model. Today it is probably the most commonly used model |
Pages 1029-1030: Source code for the ClientSocket.java program | |
---|---|
The GET request as shown in the book works only under the ancient 0.9 version of HTTP. For HTTP 1.0 and 1.1, a GET request consists of multiple lines that look like:
GET pathname_to_resource HTTP 1.x
HTTP 1.0 defines 16 headers, all optional. HTTP 1.1 defines 46 headers, with just the Host: header mandatory. Each line of a multiline request must end in CRLF, a two-character sequence consisting of "carriage return" followed by "linefeed". |
Page 1040: The beginning section of the program ClientSocket.h in the lower half of the page (fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <qsocket.h>
|
corrected version: |
#include <qsocket.h>
|
Pages 1041-1043: Source code for the ClientSocket.cc program | |
---|---|
The GET request as shown in the book works only under the ancient 0.9 version of HTTP. For HTTP 1.0 and 1.1, a GET request consists of multiple lines that look like:
GET pathname_to_resource HTTP 1.x
HTTP 1.0 defines 16 headers, all optional. HTTP 1.1 defines 46 headers, with just the Host: header mandatory. Each line of a multiline request must end in CRLF, a two-character sequence consisting of "carriage return" followed by "linefeed". |
Page 1049: Missing return statement after the fourth line from the bottom of the page
(fixed in the second printing of the book) |
|
---|---|
fourth and fifth lines from the bottom of the page as currently set: |
chatServer = other.chatServer; } |
corrected version: |
chatServer = other.chatServer; return *this; } |
Page 1058: Fifth line of the fourth paragraph
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
database. A commonly used driver by Java programs is the open-sourceMM.MySQL
|
corrected version: |
database. A commonly used driver by Java programs is the open-source MM.MySQL
|
Page 1059: First line of the third paragraph
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | A driver manager can also help establish a connection with a database. Using the |
corrected version: | A driver manager can also help establish a connection with a database. Using for |
Page 1064: Second line of the text just above the last table
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | more (now shown), MySQL will respond to the SELECT command by returning the |
corrected version: | more (not shown), MySQL will respond to the SELECT command by returning the |
Page 1077: The beginning section of the program DBFriends1.cc in the lower third of the page (fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <iostream>
|
corrected version: |
#include <iostream>
|
Page 1079: The beginning section of the program DBFriends2.cc in the lower third of the page (fixed in the second printing of the book) |
|
---|---|
lines as currently set: |
#include <iostream>
|
corrected version: |
#include <iostream>
|
Page 1085: Citation for reference 33
(fixed in the second printing of the book) |
|
---|---|
line as currently set: |
http://java.sun.com/j2se/1.3/docs/index.html . Java 2 SDK, Standard Editor Doc-
|
corrected version: |
http://java.sun.com/j2se/1.3/docs/index.html . Java 2 SDK, Standard Edition Doc-
|
Page 1110: Last entry in the left column
(fixed in the second printing of the book) |
|
---|---|
line as currently set: | sizeof, 6-7, 98, 117, 125 |
corrected version: | sizeof, 6-7, 99, 117, 125-128 |