📄 errata.html
字号:
169-70 11.2 C99 *is* available in electronic form, for $18 from www.ansi.org .174 11.10 As written, the "complicated series of assignments" of course includes some declarations and initializations. [Thanks to James Stern]175 11.10 "e.g., (const char) ** in this case" should be "e.g., (const char **) in this case" "when the pointers which" should either be "when the pointers" or "with pointers which"180 11.19 "questions 20.20" should be "question 20.20"182 11.25 "The function offers" should be "The memmove function offers". [Thanks and $1 to Gordon Burditt]183-4 11.27 In C99, external identifiers are required to be unique in the first 32 characters; C90's extremely Spartan limitation to six characters has been relaxed.186 11.29 You may also need to rework calls to realloc that use NULL or 0 as first or second arguments (see question 7.30).186 11.29 You may also need to rework conditional compilation involving #elif. See also the Rationale's list of "Quiet Changes" (see question 11.2). [Thanks to James Stern]189 11.33 A fourth class of behavior is locale-specific. [Thanks and $1 to James Stern]198 12.11 A semicolon is missing after "int i = 0". The } just before the line "*p = '\0'" is indented one tab too few. Two instances of "*--p" have the minus signs merged so as to appear as one.201 12.16 [case 2] The variable line is not declared; it should probably be a char [], suitably initialized, e.g.: char line[] = "1 2.3 4.5e6 789e10"; [Thanks and $1 to James Stern]205 12.19 There's an extraneous double quote in what should be "intervening whitespace:".207-8 12.21 The technique of writing to a file may give the wrong answer if the disk fills up. [Thanks and $1 to Mark Brader] The "hope that a future revision of the ANSI/ISO C Standard will include" the snprintf function has been fulfilled: C99 does specify it. As a bonus, the C99 snprintf can be used to predict the size required for an arbitrary sprintf call, too -- it can be called with a null pointer instead of a destination buffer (and 0 as the size of that nonexistent buffer) and it returns the number of characters it would have written.212 12.28 The answer is in the wrong font.213 12.30 Updating (overwriting) a text file in-place is not fully portable; the C Standard leaves it implementation-defined whether a write to a text file truncates it at that point. [Thanks and $1 to Tanmoy Bhattacharya]224 13.4 "upper- or lowercase" should probably be "upper or lower case".225 13.6 Since the fragment calls printf, it must #include <stdio.h>. [Thanks and $1 to James Stern]226 13.6 [last code fragment] A declaration and initialization char string[] = "this\thas\t\tmissing\tfield"; similar to the one on p. 225 should appear. [Thanks and $1 to Doug Liu]227 13.6 Also, since the input string is modified, it must be writable; see question 1.32.234 13.14 "time_ts" should perhaps be "time_t's"240 13.17 The code srand((unsigned int)time((time_t *)NULL)); though popular and generally effective is, alas, not strictly conforming. It's theoretically possible that time_t could be defined as a floating-point type under some implementation, and that the time_t values returned by time() could therefore exceed the range of an unsigned int in such a way that a well-defined cast to (unsigned int) is not possible.242-3 13.20 The attributions listed for methods 2 and 3 are scrambled. Method 2 is the one described in the 1958 Box and Muller paper (as well as by Abramowitz and Stegun, apparently). Method 3 is originally due to Marsaglia.244 13.21 If you're not familiar with the notation [0, 1), it means that drand48() returns a number x such that 0 <= x and x < 1.250 14.5 The suggested expression should read fabs(a - b) <= epsilon * fabs(a) It performs poorly if a == 0.0 (which is another argument in favor of "mak[ing] the threshold a function of b, or of both a and b").253 14.8 Of course, you can always compute pi using 4*atan(1.0) or acos(-1.0). [Thanks to James Stern and Clinton Sheppard]253 14.9 C99 specifies isnan() and several other classification routines.254-5 14.11 C99 supports complex as a standard type.260-1 15.4 The first argument to vstrcat() could be const char *, as could the fmt argument to miniprintf(). [Thanks to James Stern]264 15.5 The fmt argument to error() could be const char *.269-71 15.12 The fmt arguments to faterror(), verror(), and error() could all be const char *.274 16.4 [point 2] The problem could be caused by a setbuf or setvbuf buffer local to any function. [Thanks and $1 to James Stern]276 16.7 Variable "s" isn't declared. It's pretty obvious what it should be, but to make it explicit, change the struct declaration to struct mystruct { ... } s; [Thanks to Peter Hryczanek]287 18.1 The URL in the list of metrics tools is really "http://www.qucis.queensu.ca:1999/Software-Engineering/Cmetrics.html".294 18.13 The conventional spelling is "NetBSD". [Thanks and $1 to Peter Seebach]294 18.14 Extra space in site which should be "sunsite.unc.edu".296 18.16 Extra space in address which should be "archie@archie.cs.mcgill.ca".308 19.11 Note that a test using fopen() *is* approximate; failure does not necessarily indicate nonexistence.310 19.14 Updating (overwriting) a text file in-place is not fully portable; the C Standard leaves it implementation-defined whether a write to a text file truncates it at that point. [Thanks and $1 to Tanmoy Bhattacharya]314 19.23 In C99, the guarantee on the possible size of a single object has been raised to 64K.315 19.25 Use of the `volatile' qualifier is often appropriate when performing memory-mapped I/O. [Thanks to Lee Crawford]317 19.27 The return value of system() is not guaranteed to be the command's exit status. [Thanks and $1 to Peter Seebach]318 19.30 If you forget to call pclose, it's probably at least as likely that you'll run out of file descriptors as processes. [Thanks and $1 to Jens Schweikhardt]319 19.31 argv[0] may also be a null pointer. [Thanks and $1 to Tanmoy Bhattacharya]324 19.42 "control characters, such as" should be "control characters such as"339-40 The page break makes the code very hard to follow.342-44 20.13 The tone of this question's answer can be read as suggesting that efficiency isn't important at all. That's not the case, of course -- efficiency can very important, and poorly-written programs can run abysmally inefficiently. The point is that there are good ways and bad ways of achieving an appropriate level of performance for a given program, and that (for example) picking a good algorithm tends to make a much bigger difference than does microoptimizing the coding details of a lesser algorithm.346 20.17 Missing tab in line which should be #define CODE_NONE 0350 20.21 The overbars are misaligned.355 20.29 "and computes that number" should either be "computed" or "and is computed".363 [aggregate] Unions are not aggregates. [Thanks and $1 to Kinichi Kitano]368 [parameter] Extraneous semicolon at end of line which should be f(int i)370-1 The glossary entry for "undefined" is misplaced. [Thanks and $1 to James Stern]376 The two minus signs in the index entry for "-- operator" overlap and appear to be one.379 The pairs of underscores in the index entry for "__FILE__ macro" overlap and might appear to be one.382 The pairs of underscores in the index entry for "__LINE__ macro" overlap and might appear to be one.back cover "on the Usenet/Internet on the C FAQ" is muddled and should say something else. "com.lang.c" should be "comp.lang.c". The ftp address for source code should be ftp://ftp.aw.com/cseng/authors/summit/cfaq .<hr><a href="http://www.awl.com/cseng/titles/0-201-84519-9">more information about this book</a><br><a href="http://www.eskimo.com/~scs/C-faq.top.html">on-line version of FAQ list</a><br><a href="http://www.eskimo.com/~scs/">scs home page</a></pre></body>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -