C++ Cookbook

Errata for C++ Cookbook

Submit your own errata for this product.


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 5
Table 1-2, 2nd row [Intel (Linux)], 2nd column [Compiler]

"lcpc" should be: "icpc"

Anonymous    Sep 01, 2007
Printed
Page 75
Code in middle of page

# Generate dependencies of .ccp files on .hpp files include john.o paul.o johnpaul.o NOW READS: # Generate dependencies of .cpp files on .hpp files include john.d paul.d johnpaul.d

Anonymous    Feb 01, 2006
Printed
Page 210
3rd line

self operator+() { return self(-m); } should be: self operator+() { return self(+m); } ^

Anonymous    Sep 01, 2007
Printed
Page 259 & 278
in the code

#include "utils.h" // For printContainer(): see 7.10 should be: #include "utils.h" // For printContainer(): see 7.11

Anonymous    Sep 01, 2007
Printed
Page 356
4th line from bottom

double pi = 3.14285714; NOW READS: double pi = 3.14159265;

Anonymous    Feb 01, 2006
Printed
Page 357
The three lines just before the "Discussion" heading

pi = 3.1429 pi = +3.143 pi = 3.143e+003 NOW READS: pi = 3.1416 pi = +3.142 pi = 3.142e+003

Anonymous    Feb 01, 2006
Printed
Page 357
Paragraph under "Normal (the default)", last sentence

So, by default, pi would be displayed as 3.14286, and pi times 100 would display 314.286. NOW READS: So, by default, pi would be displayed as 3.14159, and pi times 100 would display 314.159.

Anonymous    Feb 01, 2006
Printed
Page 357
Paragraph under "Fixed", 2nd sentence

...pi would be displayed as 3.142857, and pi times 100 would be 314.285714. NOW READS: ...pi would be displayed as 3.141593, and pi times 100 would be 314.159265.

Anonymous    Feb 01, 2006
Printed
Page 357
Paragraph under "Scientific", last sentence

...pi times 1,000 would display as 3.142857e+003. NOW READS: ...pi times 1,000 would display as 3.141593e+003.

Anonymous    Feb 01, 2006
Printed
Page 358
3rd column, lines 2, 5, 10, 12

pi = 3.142857 pi = 3.142857e+003 pi = 3.143 pi = 3.143e+000 NOW READS: pi = 3.141593 pi = 3.141593e+003 pi = 3.142 pi = 3.142e+000

Anonymous    Feb 01, 2006
Printed
Page 359
10th line from top

pi = 3142.86 NOW READS: pi = 3141.59

Anonymous    Feb 01, 2006
Printed
Page 360
10th line from top

double pi = 22.0/7.0; NOW READS: double pi = 3.14159265;

Anonymous    Feb 01, 2006
Printed
Page 376
Example 10-13, first 3 lines

#include <iostream> #include <cstdio> int main() { NOW READS: #include <iostream> #include <cstdio> using namespace std; int main() {

Anonymous    Feb 01, 2006
Printed
Page 376
Example 10-13, 2nd line from end

std::cout << buf << ' '; NOW READS: cout << buf << ' ';

Anonymous    Feb 01, 2006
Printed
Page 377
Example 10-14, first 5 lines

#include <iostream> #include <fstream> #include <cstdio> #include <string> int main() { NOW READS: #include <iostream> #include <fstream> #include <cstdio> #include <string> using namespace std; int main() {

Anonymous    Feb 01, 2006
Printed
Page 377
Example 10-14, line 11

std::cerr << "Couldn't create temp file name. "; NOW READS: cerr << "Couldn't create temp file name. ";

Anonymous    Feb 01, 2006
Printed
Page 377
Example 10-14, line 14

std::cout << "The temp file name is: " << pFileName << ' '; NOW READS: cout << "The temp file name is: " << pFileName << ' ';

Anonymous    Feb 01, 2006
Printed
Page 377
Example 10-14, line 15

std::ofstream of(pFileName); NOW READS: ofstream of(pFileName);

Anonymous    Feb 01, 2006
Printed
Page 377
Example 10-14, lines 20-21

std::ifstream ifs(pFileName); std::string s; NOW READS: ifstream ifs(pFileName); string s;

Anonymous    Feb 01, 2006
Printed
Page 378
Example 10-14 (continued), topmost line

std::cout << "Just read in "" << s << "" "; NOW READS: cout << "Just read in "" << s << "" ";

Anonymous    Feb 01, 2006
Printed
Page 378
Example 10-15, first 4 lines

#include <iostream> #include <direct.h> int main(int argc, char** argv) { NOW READS: #include <iostream> #include <direct.h> #include <cstring> #include <errno.h> #include <cstdlib> using namespace std; int main(int argc, char** argv) {

Anonymous    Feb 01, 2006
Printed
Page 378
Example 10-15, line 5

std::cerr << "Usage: " << argv[0] << " [new dir name] "; NOW READS: cerr << "Usage: " << argv[0] << " [new dir name] ";

Anonymous    Feb 01, 2006
Printed
Page 378
Example 10-15, line 9

std::cerr << "Error: " << strerror(errno); NOW READS: cerr << "Error: " << strerror(errno);

Anonymous    Feb 01, 2006
Printed
Page 379
Code example, middle of page, first 4 lines

#include <iostream> #include <sys/types.h> #include <sys/stat.h> int main(int argc, char** argv) { NOW READS: #include <iostream> #include <sys/types.h> #include <sys/stat.h> #include <cstring> #include <errno.h> #include <cstdlib> using namespace std; int main(int argc, char** argv) {

Anonymous    Feb 01, 2006
Printed
Page 379
Code example, middle of page, line 6

std::cerr << "Usage: " << argv[0] << " [new dir name] "; NOW READS: cerr << "Usage: " << argv[0] << " [new dir name] ";

Anonymous    Feb 01, 2006
Printed
Page 379
Code example, middle of page, line 10

std::cerr << "Error: " << strerror(errno); NOW READS: cerr << "Error: " << strerror(errno);

Anonymous    Feb 01, 2006
Printed
Page 406
Table 11-1, 1st row, 2nd column

--- n (x - mean) / i / --- should be: --- n (x - mean) P(x ) / i i / --- (i.e. the summation of x sub i minus the mean to the nth power, times the probability of x sub i)

Anonymous    Sep 01, 2007
Printed
Page 406
Table 11-1, 2nd row, 2nd column

u 2 should be: u 2 (i.e. u sub 2, where 'u' is meant to represent the greek letter 'mu')

Anonymous    Sep 01, 2007
Printed
Page 406
Table 11-1, 3rd row, 2nd column

/ / u 2 should be: ___ / / u / 2 (i.e. the square root of u sub 2, where 'u' is meant to represent the greek letter 'mu')

Anonymous    Sep 01, 2007
Printed
Page 406
Table 11-1, 4th row, 2nd column

3/2 u 3 / u 2 should be: 3/2 u / u 3 2 (i.e. u sub 3 divided by u sub 2 to the 3/2 power, where 'u' is meant to represent the greek letter 'mu')

Anonymous    Sep 01, 2007
Printed
Page 406
Table 11-1, 5th row, 2nd column

2 (u 4 / u 2 ) - 3 should be: 2 ( u / u ) - 3 4 2 (i.e. u sub 4 divided by u sub 2 squared, minus 3, where 'u' is meant to represent the greek letter 'mu')

Anonymous    Sep 01, 2007
Printed
Page 467
Example 13-1, 8th line

In the line: wstring ws2 = L"Euro: _"; the underscore should be replaced by the Euro symbol.

Anonymous    Sep 01, 2007
Printed
Page 468
2nd line of code

In the line: wstring ws2 = L"Euro: _"; // Or just type it in the underscore should be replaced by the Euro symbol.

Anonymous    Sep 01, 2007
Printed
Page 484
3rd paragraph, 1st sentence

"...you may want download and install the libraries..." should be: "...you may want to download and install the libraries..."

Anonymous    Sep 01, 2007
Printed
Page 494
12th line in example 14-4

...string to wide-charactr string... Should be ...string to wide-character string...

Anonymous    Sep 01, 2007
Printed
Page 497
2nd paragraph, 2nd sentence

"(See Example 14-2 for the definition of the class Animal.)" should be: "(See Example 14-2 for the C++ definition of the class Animal.)"

Anonymous    Sep 01, 2007