[转] C++ Primer Plus (第五版)中文版 勘误表

C++ Primer Plus (第五版)中文版 勘误表 (不断更新) 最后更新 2007年2月21日
这是我在读《c++ Primer Plus》中发现的明显的错误

中文版第4页倒数第18行 错误程度:***
"http://www.research.att.com/-bs/"
网页错了,应该是"http://www.research.att.com/~bs/"也不说什么了。

中文版第9页 21行 (好像是OCR 才能犯的错误) 错误程度:**
"某个源代码文件,如mu.cxx,则可使用my.cxx 和precious.o 来重新编译"
其中"mu.cxx" 应改为 "my.cxx"
英文版原文为
If you subsequently modify just one of the source code files, say my.cxx, you can recompile using my.cxx and the precious.o:

中文版第13页第12行(量词错误,看上去就像不懂程序设计的人翻译的)错误程度:*
"这样老式的,则要么换一台新的编译器"
其中 编译器是一个程序,应该按照中文版第8页的所使用的量词 "换一个新的编译器"这样比较合适。

中文版第26页,27页插图中 错误程度:**
调用函数的代码都打成了"S = sqrt(6+25)", 但根据前后文,应该为6.25
不过这个错误英文版中也犯了。

中文版第41页,到数第14行 错误程度:**
"也就是说,预处理器不会将PINT_MAXTM 替换为 P32767IM。"
其中 "PINT_MAXTM"应改为 PINT_MAXIM 可能是译者看错了吧。
英文版原文为
That is, the preprocessor doesn't replace PINT_MAXIM with P32767IM.

中文版第47页第18行 错误程度:****
"最后,程序使用cout.put()函数来显示c和a字符常量。"
这里犯了一个非常低级,非常严重的错误。
先看一下英文版原文
Finally, the program uses the cout.put() function to display both c and a character constant.
正确的译法为
最后,程序使用cout.put()函数来显示ch和一个字符常量。
因为在英文版中 程序清单3.6(morechar.cpp) 是这样的
// morechar.cpp -- the char type and int type contrasted
#include <iostream>
using namespace std;
int main()
{
    char c = 'M';       // assign ASCII code for M to c
    int i = c;          // store same code in an int
    cout << "The ASCII code for " << c << " is " << i << "\n";

    cout << "Add one to the character code:\n";
    c = c + 1;
    i = c;
    cout << "The ASCII code for " << c << " is " << i << '\n';

    // using the cout.put() member function to display a char
    cout << "Displaying char c using cout.put(c): ";
    cout.put(c);

    // using cout.put() to display a char constant
    cout.put('!');

    cout << "\nDone\n";
    return 0;
}

这里没有ch变量,而是c变量,所以,中文版这里犯了两个错误,中文版程序修改了英文版的程序,但稍后的程序说明中却没有改,甚至把a(表数量)翻译成了变量名,不知道当时翻译的人在做什么。

中文版第47页最后三行、第48页前两行 错误程度:*
" 'a' is 97, 即字符a的ASCII码。 "
不知我为什么译者指翻译了第一句而后面的5句都没有翻译。
这里这本书的出错频率从前面几十页的平均10页一个错误到这里一页两个错误

中文版第49页倒数第10行 错误程度:*
"通用字符名的用法类似于转义序列。"
单看这句似乎没问题,但当把它与英文版对照时就有不同了
应该是"这种机制类似于转义序列"
英文版原文为
The mechanism is similar to that of escape sequences.

中文版第60页第22行 错误程度:**
"int 变量 debt 无法存储 3.0E12, "
其中根据程序清单3.13(assign.cpp)中 给debt的只应该是7.2E12而不是3.0E12,但是这在英文版中也犯了同样的错误。
英文版原文为:
Finally, note that the int variable debt is unable to hold the value 3.0E12.

中文版第64页倒数第8行 错误程度:***
"31600000 seconds = 365 days, 46 minutes, 40 seconds"
但是,我写出来的程序运行结果是:
31600000 seconds = 365 days, 17 hours, 46 minutes, 40 seconds
一开始我以为是我错了,但是经过无数次的验算之后,Sample Output错了。我的程序中还使用了if语句,来判断0的情况,做题时就感到题目有些超前了。

中文版第772页倒数第7行 错误程度:**
"第一条语句才将得分设置为字母A"
其中得分是个变量,虽然在语句中的grade翻译成得分,但是它毕竟是变量名,所以应该改为"第一条语句才将grade设置为字母A"
英文版原文为:
the first statement assigns the letter A to grade only on a system using the ASCII code

中文版第76页倒数第5行 错误程度;*
"<< str1 << ""<< str2 // use cout for output"
没错,是程序中的错误,这里在str1与str2中间的字符串中没有打空格,为了保持上下文的一致性,应该在这个字符串常量中加上一个空格,所以应改为:
"<< str1 << " " << str2 // use cout for output"

中文版第90页最后一行 错误程度;*
"*操作符被称为间接值(indirect velue)或解除引用(dereferencing)操作符"
单词拼错了,应该是value
英文版原文为:
Applying the * operator, called the indirect value or the dereferencing operator

中文版第113页 倒数第3行 错误程度;**
"smart_function (i);"
前面的提示已经说了,在for和括号之间加上一个空格,而省略函数名与括号之间的空格:但是我怎么也没看出for和smart_function后面和空格的距离有什么差别,应该是
for (int i = 6; i < 10; i++)
smart_function(i);
英文版原文为:
for (int i = 6; i < 10; i++)
      smart_function(i);

中文版第117页第10行 错误程度;***
"//int i;"
不明白为什么i的声明语句要打注释,我以为可以这样用,但是发现不对。英文版中是没有注释的。
英文版原文为:
// formore.cpp -- more looping with for
#include <iostream>
using namespace std;
const int ArSize = 16;      // example of external declaration
int main()
{
    double factorials[ArSize];
    factorials[1] = factorials[0] = 1.0;
    int i;
    for (i = 2; i < ArSize; i++)
        factorials[i] = i * factorials[i-1];
    for (i = 0; i < ArSize; i++)
        cout << i << "! = " << factorials[i] << "\n";
    return 0;
}

中文版第127页倒数第10行 错误程度:*
"则strcpm()将返回一个正数值"
应该是strcmp()函数
英文版原文为:
strcmp() returns a positive value.

中文版第129页 第19行 错误程度:***
"for (char ch = 'a'; word !="
源代码中for语句只写了一半,后半部份消失了
英文版原文为:
for (char ch = 'a'; word != "mate"; ch++)

中文版第133页第15行 错误程度:**
"或者将秒数乘以CLOCK_PER_SEC,得到以系统时间单位为单位的时间。"
其中 常量CLOCK_PER_SEC是一个不存在的常量,应该是CLOCKS_PER_SEC 漏了一个"S"
英文版原文为:
you can multiply seconds by CLOCKS_PER_SEC to get time in the system units

中文版第134页第19行 错误程度:*
"是出口条件 (exit condition) 循环"
根据中文版第113页倒数19行 "for 循环是入口条件 (entry-condition) 循环"入口与条件之间有连接符,那么,相应地,在出口与循环之间也应该有间接符。
英文版原文为:
It's different from the other two because it's an exit-condition loop

中文版第144页最后1行 错误程度:****
"char cities[25][Cities] = // array of 5 arrays of 25 char"
这样创建的二维数组根本不是所需要的二维数组,应该是
char cities[Cities][25] =

中文版第153页 表6.1
算不上错误,但是,确实给阅读造成困难
中文版中把这张表格一分为二,而且左右并排,又把 "expr1 || expr2的值"单独放在一列中,而且表格分开后,又不把东西补完整,刚看这张表格的时候,出现了这么多的空格,实在是不理解,
真正的意图应该是这样的(根据英文版中,"The Value of expr1||expr2" 所在的行是合并的)
        The Value of expr1 || expr2
   expr1 == ture   expr1 == false
expr2 == true true    true
expr2 == false true    false

中文版第153页倒数第3行 错误程度:**
"冒号和逗号操作符也是顺序点"
-_-!
应该是:
分号和逗号操作符也是顺序点

原文地址:https://www.cnblogs.com/jz319/p/1638590.html