Code Complete

Errata for Code Complete




The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question Note Update



Version Location Description Submitted By Date Submitted Date Corrected
Printed
Page 65

Incorrect Information About JavaScript There is an error regarding JavaScript on page 65. Change: "JavaScript is an interpreted language that is loosely" To: "JavaScript is an interpreted language that was originally loosely"

Microsoft Press  May 06, 2010  Nov 19, 2010
Printed
Page 81

Incorrect Information Regarding Classes There is an error in the first paragraph on page 81.Change:"the number of routines called from within a routine or from within a class"To:"the number of routines called from within a routine or the number of classes used within a class"

Microsoft Press  Jul 13, 2010  Nov 19, 2010
Printed
Page 140
2nd paragraph

"In this case, the client code is intended to use the Address type for addresses but the header file exposes the implementation detail that addresses are stored as Strings" Looking at the implementation details above that text, it seems like address is ALWAYS a string (there is no Address type): Employee( ..., String address, ... ) String GetAddress() const; However, I think this should refer to the implementation details of either FullName or JobClassification (for which the private member variables expose the fact that FullName is a String and JobClassification is an int).

Note from the Author or Editor:
In the paragraph following the code sample on p. 140, the second sentence should read like this: In this case, the client code is intended to use the JobClassification type for job class, but the header file exposes the implementation detail that job class is stored as an integer. ["JobClassification" should be formatted in italics]

Suresh Joshi  Jun 09, 2011 
Printed
Page 226

Error Should Be ErrorToReport There is an error on page 226 after the code sample. Change: "Italicized variable name 'error'" To: "Italicized variable name 'errorToReport'"

Microsoft Press  May 06, 2010  Nov 19, 2010
Printed
Page 229

Incorrect Page Numbers On page 229, there is an error in the 2nd paragraph: Change: "Now look again at the spec on page 000 and the initial pseudocode on page 000." To: "Now look again at the spec on page 221 and the initial pseudocode on page 224."

Microsoft Press  Jul 13, 2010  Nov 19, 2010
Printed
Page 240

Option Explicit Should Be Num There is an error in the middle of page 240. Change: "common suffixes such as Option Explicit and No" To: "common suffixes such as Num and No"

Microsoft Press  May 06, 2010  Nov 19, 2010
Printed
Page 266

Error in Code Sample There is an error in the second code sample on page 266. Change: "if ( recalcNeeded == True )"To: "if ( recalcNeeded == false )"

Microsoft Press  Jul 13, 2010  Nov 19, 2010
Printed
Page 267

"roots" used in place of "solutions" in code samples On page 267, the second and third code samples read: C++ Example of an Uninformative “Temporary” Variable Name // Compute roots of a quadratic equation. // This assumes that (b^2-4*a*c) is positive. temp = sqrt( b^2 - 4*a*c ); root[0] = ( -b + temp ) / ( 2 * a ); root[1] = ( -b - temp ) / ( 2 * a );C++ Example with a “Temporary” Variable Name Replaced with a Real Variable // Compute roots of a quadratic equation. // This assumes that (b^2-4*a*c) is positive. discriminant = sqrt( b^2 - 4*a*c ); root[0] = ( -b + discriminant ) / ( 2 * a ); root[1] = ( -b - discriminant ) / ( 2 * a ); They should read: C++ Example of an Uninformative “Temporary” Variable Name // Compute solutions to a quadratic equation. // This assumes that (b^2-4*a*c) is positive. temp = sqrt( b^2 - 4*a*c ); solution[0] = ( -b + temp ) / ( 2 * a ); solution[1] = ( -b - temp ) / ( 2 * a );C++ Example with a “Temporary” Variable Name Replaced with a Real Variable // Compute solutions to a quadratic equation. // This assumes that (b^2-4*a*c) is positive. discriminant = sqrt( b^2 - 4*a*c ); solution[0] = ( -b + discriminant ) / ( 2 * a ); solution[1] = ( -b - discriminant ) / ( 2 * a );

Microsoft Press  May 06, 2010  Nov 19, 2010
Printed
Page 294 and 295

All Instances of 100,000 Should Be 1,000,000 There are multiple typographical errors in the last paragraph on page 294, and the first paragraph on page 295. Change all instances of: "100,000" To: "1,000,000"

Microsoft Press  Jul 13, 2010  Nov 19, 2010
Printed
Page 295

Missing Minus Sign There is a minus sign missing from the first paragraph on page 295. Change: "727,379,968" To: "-727,379,968"

Microsoft Press  May 06, 2010  Nov 19, 2010
PDF, Mobi
Page 311
last para of 12.8

"Or course" should be "Of course"

Anonymous  Sep 26, 2013 
Printed
Page 330-332

Error in Code Samples The code samples on pages 330, 331, and 332 contain incorrect data. The lines of code beginning with "memset( pointer" should be removed.

Microsoft Press  Jul 13, 2010  Nov 19, 2010
Printed
Page 330

C++ Should Be C There is a typographical error in the fourth line of the fourth paragraph on page 330.Change:"C++"To:"C"

Microsoft Press  Jul 13, 2010  Nov 19, 2010
Printed
Page 330

Missing Information Regarding C++ There is an error in the first line of the fifth paragraph on page 330.Change:"Of course, this technique requires"To:"Of course, this technique will not work in C++ where the pointer points to an object, and it requires"

Microsoft Press  Jul 13, 2010  Apr 08, 2011
Printed
Page 330

Missing Reference to C There is a typographical error in the fourth paragraph on page 330.Change:"You can force errors"To:"In C, you can force errors"

Microsoft Press  May 06, 2010  Nov 19, 2010
Printed
Page 330

C++ Example Should Be C Example There is an error in the first code sample on page 330.Change:"C++ Example"To:"C Example"

Microsoft Press  May 06, 2010  Apr 08, 2011
Printed
Page 331

Invalid Statement On page 331, there is an error in the second to the last line . Change: "It can also check for a null return ..." To: "It can also be checked for an exception or a null return ..."

Microsoft Press  May 06, 2010  Nov 19, 2010
Printed
Page 333

Reference Should Be Value On page 333, Change: "Sometimes, however, you would like to have the semantics of a pass by reference" To "Sometimes, however, you would like to have the semantics of a pass by value"

Microsoft Press  Jul 13, 2010  Nov 19, 2010
Printed
Page 333

Value Should Be Reference On page 333, Change: "with the implementation of a pass by value" To:"with the implementation of a pass by reference"

Microsoft Press  May 06, 2010  Nov 19, 2010
Printed
Page 402-405

Wend Should Be End While In the code samples on pages 402-405, "Wend" should be changed to "End While" in the following locations: Page 402, first code sample, 4th line from bottom; Pages 403 and 404, first code sample, 3rd line from bottom; Page 405, first code sample, 5th line from bottom.

Microsoft Press  Jul 13, 2010  Nov 19, 2010
Printed
Page 422

Field_Last should be Field_Last+1 On page 422, +1 is missing from the second code sample on the page. Change: AbstractField* field[ Field_Last ];To: AbstractField* field[ Field_Last+1 ];

Microsoft Press  Jul 13, 2010  Nov 19, 2010
Printed
Page 422

"}" Should Be "};" There are two errors in the first code sample on page 422. In the 4th line, change the first "}" to "};" In the 10th line, change the last "}" to "};"

Microsoft Press  May 06, 2010  Nov 19, 2010
Printed, PDF, Safari Books Online, Other Digital Version
Page 422
Second code example

Change AbstractField*field[ Field_Last+1 ]; to AbstractField* field[ Field_Last+1 ]; ie, add a space between AbstractField* and field...

Note from the Author or Editor:
Corrected - will be fixed in next printing.

Anonymous  Apr 12, 2011  Aug 03, 2012
Printed
Page 423

Code sample incorrect On page 423, there is a line missing from the code sample. Change: fieldIdx = 1; while ( ( fieldIdx <= numFieldsInMessage ) && ( fileStatus == OK ) ) { fieldType = fieldDescription[ fieldIdx ].FieldType; fieldName = fieldDescription[ fieldIdx ].FieldName; field[ fieldType ].ReadAndPrint( fieldName, fileStatus ); }To: fieldIdx = 1; while ( ( fieldIdx <= numFieldsInMessage ) && ( fileStatus == OK ) ) { fieldType = fieldDescription[ fieldIdx ].FieldType; fieldName = fieldDescription[ fieldIdx ].FieldName; field[ fieldType ].ReadAndPrint( fieldName, fileStatus ); fieldIdx++; }

Microsoft Press  Jul 13, 2010  Nov 19, 2010
Printed
Page 423

"and" Should Be "&&" There is an error in the code sample on page 423. Change: "and" To: "&&"

Microsoft Press  May 06, 2010  Nov 19, 2010
Printed
Page 512

"line 15" Should Be "line 12" In Table Case 8 in the table on page 512 contains an error. Change: "line 15" To: "line 12"

Microsoft Press  May 06, 2010  Nov 19, 2010
PDF, Mobi
Page 606
under "Additional Resources"

releated to performance should be related to performance

Anonymous  Sep 26, 2013 
Printed
Page 610

x Is Not Greater Than 5 There is an error in the 3rd paragraph on page 610. Change: "Once you've determined that x is greater than 5" To: "Once you've determined that x is not greater than 5"

Microsoft Press  Jul 13, 2010  Nov 19, 2010
Printed
Page 613

"C++" Should Be "C#" There are two errors in the 2nd paragraph on page 613. Change both instances of: "C++" To: "C#"

Microsoft Press  May 06, 2010  Nov 19, 2010
Printed
Page 614

Minus sign missing from table On page 614, the Time Savings column of the Visual Basic row of the table reads: "258%" It should read: "-258%"

Microsoft Press  Jul 13, 2010  Nov 19, 2010
Printed
Page 619

Error In Code Sample There is an error in the 1st code sample on page 619. In the 3rd line from the bottom, Change: "if ( i == count )" To: "if ( i == count - 1 )"

Microsoft Press  May 06, 2010  Nov 19, 2010
Printed
Page 641

Two extra lines included in code sample On page 641, the var section of the first code sample reads: var index: integer; lowerByte: byte; upperByte: byte; targetIndex: integer; It should read: var index: integer; targetIndex: integer;

Microsoft Press  Jul 13, 2010  Nov 19, 2010
Printed
Page 655

"architecture" used in place of "architecture and requirements" On page 655, the second and third sentences of the second paragraph read: "Barry Boehm and Richard Turner found that spending about five percent of total project costs on architecture produced the lowest cost for projects in the 10,000-lines-of-code range. But for projects in the 100,000-lines-of-code range, spending 15–20 percent of project effort on architecture produced the best results (Boehm and Turner 2004)." They should read: "Barry Boehm and Richard Turner found that spending about five percent of total project costs on architecture and requirements produced the lowest cost for projects in the 10,000-lines-of-code range. But for projects in the 100,000-lines-of-code range, spending 15–20 percent of project effort on architecture and requirements produced the best results (Boehm and Turner 2004)."

Microsoft Press  May 06, 2010  Nov 19, 2010
Printed
Page 752

Errors In Code Sample There are two errors in the middle code sample on page 752. Change: "if ( mainColor = BallColor_White" To: "if ( mainColor == BallColor_White" And change: "if ( mainColor = BallColor_Blue" To: "if ( mainColor == BallColor_Blue"

Microsoft Press  Jul 13, 2010  Nov 19, 2010
Printed
Page 758

Incorrect Listing Reference There is an incorrect listing reference 3/4 of the way down page 758.Change:"In Listing 31-45"To:"In Listing 31-47"

Microsoft Press  May 06, 2010  Nov 19, 2010
Printed
Page 770

Maximum referenced in place of minimum On page 770, the 23rd line of the code sample reads: // find the arithmetic maximum of arg1 and arg2 It should read: // find the arithmetic minimum of arg1 and arg2

Microsoft Press  Jul 13, 2010  Nov 19, 2010
Printed
Page 779

Error In Second Code Sample There is an error in the 5th line from the bottom of the 2nd code sample on page 779.Change:"for ( primeCandidate = 1;"To:"for ( primeCandidate = 2;"

Microsoft Press  Jul 13, 2010  Nov 19, 2010
Printed
Page 779

Error In First Code Sample There is an error in the 1st code sample on page 779.Change:"for ( i = 1;"To:"for ( i = 2;"

Microsoft Press  May 06, 2010  Nov 19, 2010
Printed
Page 858

Incorrect Address The address in the 2nd paragraph from the bottom of page 858 is not valid.Change:"write: ACM, PO Box 12114, Church Street Station, New York, NY 10257"To:"see www.acm.org." Microsoft Press is committed to providing informative and accurate books. All comments and corrections listed above are ready for inclusion in future printings of this book. If you have a later printing of this book, it may already contain most or all of the above corrections.

Microsoft Press  May 06, 2010  Nov 19, 2010