The errata list is a list of errors and their corrections that were found after the product was released.
The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.
| Version |
Location |
Description |
Submitted By |
| Printed |
Page 4
All chapter 4 |
Hello,
(The problem does not concern page 4, but chapter 4 examples. I haven't browsed the other chapters
yet.)
The uses of stream.eof() and getline are incorrect. The lines should be read with:
while(std::getline(in, tmp, '
'))
see http://www.parashift.com/c++-faq-lite/input-output.html#faq-15.5
|
Anonymous |
| Printed |
Page 12
Top third of the page in the Tip, suggestion or general note section |
The Tip reads as follows:
Before you start working through the recipes in this chapter, create four sibling directories
johnpaul, geogreringo, hellobeatles, and binaries...
The directory geogreringo is later referenced as georgeringo (which I suspect is the correct name).
|
Anonymous |
| Printed |
Page 105
Example 2-1 |
In example 2-1 and all following examples, you use
FILENAME_H__ as the include guard.
However, the C++ Standard ISO/IEC 14882:2003 explicitly reserves to the implementation all
identifiers containing a double underscore.
The include guards in the examples should simply use a single trailing underscore:
FILENAME_H_
|
Anonymous |
| Printed |
Page 125
half way down |
The output shown for example 3-4 should be:
There are 3 ways to do this.
There are Those cost $50.
abc123
rather than:
There are 3 ways to do this.
Those cost $50.
abc123
I ran this example and researched the boost format.hpp and discovered that the code line f.clear()
clears the bound items not the object f as it was declared. so the no bound items. so everything
from %1% on in the declaration of f is cleared.
I compiled the code on MinGW 3.4.2 compiler using Eclipse CDT as my IDE.
|
Anonymous |
| Printed |
Page 154
Example 4-10 |
The function
void split(...)
you show in this example will fail, if the string does not contain the separator character. The resulting vector<string> will not contain any entries, while I would expect it to contain one entry, the full input string.
A possible solution (add lines marked with a +):
void split(const string& s, char c,
vector<string>& v) {
string::size_type i = 0;
string::size_type j = s.find(c);
+ if (j == string::npos) {
+ v.push_back(s);
+ return;
+ }
while (j != string::npos) {
// ... the while loop as in the example
}
}
|
Fabian Kislat |
| Printed |
Page 195
in function "loadCSV" 3rd comment line |
the comment "// Recipe 4.7" should refer to 4.6, i.e. should read
"// Recipe 4.6"
|
Anonymous |
| Printed |
Page 216
11th line from bottom |
I am not at all a C++ expert so I may have missed something here. However, on page
216 in the initial vector example, the code near the bottom of the page reads:
string s = "Marines";
vector<string>::iterator p = find(strVec.begin(), strVec.end(), s);
if (s != strVec.end()) // Insert s immediately before the element
strVec.insert(p,s); // p points to.
************* With my compiler (Digital MARS - I have others this is just the one I
happened to be playing with - it coughs on the s != strVec.end() statement. I think
this is because the statement should read: if (p != strVec.end()) .... as the
iterator should be used.
|
Anonymous |
| Printed |
Page 312
First three lines in Example 8-12, second page |
As is, this code generates malloc errors when run, the reason being that the recursive delete tries
to delete a pointer that is really a pass by reference.
This can be fixed by using
TreeNode<string>* node1 = new TreeNode<string>("frank");
....
node1->addChild(node2);
This problem, however, is something that might merit discussion as it had me confused for a bit.
|
Anonymous |
| Printed |
Page 355
Function writeTableRow |
Newer versions of gcc (3.4 and above) require "typename" to be inserted before
vector<valT>::const_iterator in the declaration of the for loop.
original:
for (vector<valT>::const_iterator p = v.begin( );
changes to:
for (typename vector<valT>::const_iterator p = v.begin( );
|
Anonymous |
| Printed |
Page 377
Example 10-14. Creating a temporary filename |
This is in reference to "10.9 Creating a Temporary Filename and File".
The example recommends using the function tmpnam to create a unique file name. Using this function is discouraged. See the man page.
tmpnam -- "Never use this function. Use mkstemp(3) instead."
|
Anonymous |
| Printed |
Page 377
Example 10-14. Creating a temporary filename |
This is in reference to "10.9 Creating a Temporary Filename and File".
The example recommends using the function tmpnam to create a unique file name. Using this function is discouraged. See the man page.
tmpnam -- "Never use this function. Use mkstemp(3) instead."
|
Anonymous |
| Printed |
Page 423
Under //constructors paragraph |
TEXT IS:
explicit matrix(const valarray<T>& x)
SHOULD BE:
explicit matrix(const std::valarray<T>& x)
|
Anonymous |
| Printed |
Page 429
Heading, Problem, Solution |
'Matricies' should be spelled 'matrices'. Misspelled in several places and in TOC (pg. ix).
|
Anonymous |
| Printed |
Page 461
paragraphs 1-3 |
In third paragraph:
"So what actually happens when submitJob calls notify_all is that the waiting
thread..." submitJob does not call notify_all in the example code. It calls notify_one.
Also, paragraphs 1-3 are in need of major editing. I have read this section at least 10 times and I
am still not sure I understand what the author is explaining.
|
Anonymous |
| Printed |
Page 534
Example 14-26 |
The example is "Adding support for serialization to the class Animal...", but the
example code shows "class Contact".
The code should be "class Animal"
|
Anonymous |