译者不厚道
(第二章,第73页的“性能提示2.8”):“如果操作程序的机器指令不如自然长度整数那么有效(例如要进行符号扩展),则用较小的整数长度会使程序减慢。”
这就怪了:我只知道C++程序最终要被编译为机器指令的形式,却不知道还有个什么“操作程序的机器指令”,也不知道机器指令怎么能够与整数进行比试。还是来看原文:
“Using smaller integer sizes may results in a slower program if the machine’s instructions for manipulating them are not as efficient as for the natural sizes integers(eg. sign extension must be done on them).”
这段话并不难译:“如果机器指令处理短整数效率不如处理自然长度整数(例如需要进行符号扩展时),那么使用短整数会使程序变慢。”显然,译者是认为第一个them是指前面的program。且不说从意思上是不是说得通,此人甚至连program之后没有一个s都顾不得了。
(第三章,第108页的“编程技巧3.6”):“许多程序员用函数原型中的参数名来说明函数,编译器将忽略这些名称。”
什么叫“用参数名来说明函数”?看一下原文:
“Many programmers use parameter names in function prototypes for documentation purposes. The compiler ignores these names.”
这句话可以这样译:“许多程序员在函数原型中使用参数名,其目的在于增强可读性。但编译器会忽略这些名称。”这句话的关键在于documentation purposes一词,我在这里姑且采用意译,未必最佳,但有一点是肯定的:比原译清楚得多。
(第三章,第114页第1行):“srand函数取一个unsigned类型的整数参数并内嵌rand函数(即种子),就可以在每次执行程序时产生不同的随机数系列。”
rand函数是种子?rand函数内嵌在srand函数中?让原文来回答吧:
“The srand function takes an unsigned integer argument and seeds the rand function to produce a different sequence of random numbers for each execution of the program.”
这句话很简单:“srand函数有一个unsigned int型参数,并为rand函数提供随机数种子,以便在每次运行程序时产生不同的随机数系列。”很清楚:rand函数不会是什么种子,Deitel也没说它要内嵌在srand函数中,译者的想象力真是可以。
这就怪了:我只知道C++程序最终要被编译为机器指令的形式,却不知道还有个什么“操作程序的机器指令”,也不知道机器指令怎么能够与整数进行比试。还是来看原文:
“Using smaller integer sizes may results in a slower program if the machine’s instructions for manipulating them are not as efficient as for the natural sizes integers(eg. sign extension must be done on them).”
这段话并不难译:“如果机器指令处理短整数效率不如处理自然长度整数(例如需要进行符号扩展时),那么使用短整数会使程序变慢。”显然,译者是认为第一个them是指前面的program。且不说从意思上是不是说得通,此人甚至连program之后没有一个s都顾不得了。
(第三章,第108页的“编程技巧3.6”):“许多程序员用函数原型中的参数名来说明函数,编译器将忽略这些名称。”
什么叫“用参数名来说明函数”?看一下原文:
“Many programmers use parameter names in function prototypes for documentation purposes. The compiler ignores these names.”
这句话可以这样译:“许多程序员在函数原型中使用参数名,其目的在于增强可读性。但编译器会忽略这些名称。”这句话的关键在于documentation purposes一词,我在这里姑且采用意译,未必最佳,但有一点是肯定的:比原译清楚得多。
(第三章,第114页第1行):“srand函数取一个unsigned类型的整数参数并内嵌rand函数(即种子),就可以在每次执行程序时产生不同的随机数系列。”
rand函数是种子?rand函数内嵌在srand函数中?让原文来回答吧:
“The srand function takes an unsigned integer argument and seeds the rand function to produce a different sequence of random numbers for each execution of the program.”
这句话很简单:“srand函数有一个unsigned int型参数,并为rand函数提供随机数种子,以便在每次运行程序时产生不同的随机数系列。”很清楚:rand函数不会是什么种子,Deitel也没说它要内嵌在srand函数中,译者的想象力真是可以。
有关键情节透露