% -*-latex-*- % Document name: /u/sy/beebe/tex/errata/stdclib.ltx % Creator: Nelson H. F. Beebe [beebe@magna.math.utah.edu] % Creation Date: Sat Oct 19 10:36:52 1991 %%% ==================================================================== %%% @LaTeX-file{ %%% author = "Nelson H. F. Beebe", %%% version = "1.05", %%% date = "21 September 1993", %%% time = "12:19:01 MDT", %%% filename = "stdclib.ltx", %%% address = "Center for Scientific Computing %%% Department of Mathematics %%% University of Utah %%% Salt Lake City, UT 84112 %%% USA", %%% telephone = "+1 801 581 5254", %%% FAX = "+1 801 581 4148", %%% checksum = "11019 711 2492 18394", %%% email = "beebe@magna.math.utah.edu (Internet)", %%% codetable = "ISO/ASCII", %%% keywords = "", %%% supported = "yes", %%% docstring = "This document contains comments and errata %%% for the book ``The Standard C Library''. %%% %%% The checksum field above contains a CRC-16 %%% checksum as the first value, followed by the %%% equivalent of the standard UNIX wc (word %%% count) utility output of lines, words, and %%% characters. This is produced by Robert %%% Solovay's checksum utility.", %%% } %%% ==================================================================== \documentstyle[twocolumn,erratum]{article} \pagestyle{myheadings} \markright{{\rm Comments and Errata for {\em The Standard C Library} [21-Sep-1993]}} \title{Comments and Errata for {\em The Standard C Library}} \author{ Nelson H. F. Beebe\\ Center for Scientific Computing\\ Department of Mathematics\\ University of Utah\\ Salt Lake City, UT 84112\\ USA\\ Tel: +1 801 581 5254\\ FAX: +1 801 581 4148\\ Email: {\tt beebe@math.utah.edu} } \date{21 September 1993 \\ Version 1.05} \begin{document} % The first page needs a bit of extra interparagraph % stretchability to avoid an underfull vbox occasioned by % the use of the verbatim environment in the first column. % Increase the glue to 2pt from 1pt. \parskip 0pt plus 2pt \maketitle This document contains remarks and corrections to the book \begin{verbatim} @String{pub-PH = "Pren{\-}tice-Hall"} @Book{Plauger:SCL91, author = "P. J. Plauger", title = "The {Standard C} Library", publisher = pub-PH, year = "1991", ISBN = "0-13-838012-0", } \end{verbatim} This book describes an implementation of a run-time library that conforms to the requirements of the ANSI/ISO C Language Standard. Because the book consists of verbatim code listings, with extensive English description in the accompanying text, I consider it an example of literate programming as espoused by Donald Knuth and others. While individual variables are not cross-referenced (as they are in Knuth's {\em Computers and Typesetting}, volumes B and D), source file names and function names are indexed, and Appendix B provides a further index of all symbolic constants and external names. These indexes make it quite easy for the reader to locate material of interest in the approximately 9000 lines of code illustrated in the book (see the author's remarks on p.~ix of the book). P.~J. Plauger, the author of this book, is the Secretary of the ANSI X3J11 committee that developed ANSI Standard X3.159-1989, also known as ISO 9899:1990. He therefore had access to the machine-readable text of the ANSI C Standard, and has incorporated those portions of it which describe the C run-time library. Since I had already read the Standard, and earlier drafts, I did not reread the text from the Standard that is cited verbatim in the book; it is possible that a few typographical errors may lurk there yet. The program code in the text was presumably incorporated directly from the actual source code which makes up the library described in the book. While I read parts of the code, and detected several errors which are noted below, there are likely additional ones that I have missed. Since this code is available from the C Users Group, and can be used under license in commercial products (p.~xii), it is important to catch such errors quickly before they become ingrained in possibly millions of computers. In the following summary of 60 errata, positive line number references count from the top of the page, and negative ones from the bottom of the page. Page headers are not counted in determining line counts, but section headings and other displayed material are. \begin{errata} \erritem{p. 1, l. 14} \erratum{ like the you write }{ like the one you write } \erritem{p. 20, l. 14} \erratum{ A naive, way }{ A naive way } \erritem{p. 51, l. -2} \erratum{ In partiular, }{ In particular, } \erritem{p. 56, l. 4} \erratum{ {\bf Vey hard} }{ {\bf Very hard} } \erritem{p. 59, l. 11} \erratum{ somehwere }{ somewhere } \erritem{p. 65, l. -3} \erratum{ constitue }{ constitute } \erritem{p. 67, l. -6} \erratum{ {\tt \#define \_DLONG 1 \#define \_DOFF 4} }{ {\tt \#define \_DLONG 1\newline \#define \_DOFF 4} } \erritem{p. 79, l. 13} \erratum{ {\tt \ \ \ \ || ULONG\_MAX < UINT\_MAX \newline \#endif} }{ {\tt \ \ \ \ || ULONG\_MAX < UINT\_MAX \newline \#error bad unsigned long properties \newline \#endif} } \erritem{p. 101, l. -3} \erratum{ machinery incidated in }{ machinery indicated in } \erritem{p. 135, l. 10} {\em It is probably safe to compare the return value of a math function against {\tt HUGE\_VAL} or {\tt -HUGE\_VAL}.} This statement may be incorrect on some IEEE implementations when projective mode is selected; according to the Intel 8087 Hardware Manual, comparison in this case will generate an exception. \erritem{p. 135, l. -6} \erratum{ Be war\kern-0.15em y }{ Be wary } Throughout the text, terminal {\em y} letters are often, though not always, kerned too close to the preceding character. This could indicate an error in the font dimensions for that letter, or an error in the typesetting software, or an error in the output device driver. \erritem{p. 149, l. 14} \erratum{ consistenly }{ consistently } \erritem{p. 149, l. 29} Norbert Juffa {\tt } writes on \mbox{19-Jan-1993}: \begin{quote} \ldots{}you introduce the macro \verb=HUGE_RAD= as being equal to 3.14e30 and explain that you can divide any value up to \verb=HUGE_RAD= by $\pi/2$ and still get a value that you can convert to a long without fear of overflow. From Figure 7.15 (showing \verb=xsin.c=) on the following page one can see that \verb=HUGE_RAD= is indeed used according to the description. As longs can only hold values of up to $2^{31}-1$, the value of \verb=HUGE_RAD= is far too big. I think that what you meant to assign to \verb=HUGE_RAD= is $3.14 \times 2^{30} \approx 3.22 \times 10^{9}$. Dividing this by $\pi/2$ would give a number slightly smaller than $2^{31}-1$. With the current value of \verb=HUGE_RAD=, about 100 bits would be needed to represent the result of a division by $\pi/2$ without overflow. \end{quote} \erratum{ {\tt \#define HUGE\_RAD 3.14e30} }{ {\tt \#define HUGE\_RAD 3.22e9} } \erritem{p. 151, l. -4} \erratum{ trignometric }{ trigonometric } \erritem{p. 151, l. -2} \erratum{ {\tt acos(x) if qoff} }{ {\tt acos(x)} if {\tt qoff} } \erritem{p. 153, l. 17} \erratum{ {\tt double tan(double x)} }{ {\tt double (tan)(double x)} } The parentheses are necessary around {\tt (tan)} to protect against macro expansion; all other public function definitions in this chapter are correctly parenthesized. \erritem{p. 156, l. 25} \erratum{ to {\tt \_Atan.z} is the }{ to {\tt \_Atan}. {\tt z} is the } \erritem{p. 156, l. 25} \erratum{ the interval [0,1].{\tt hex} divides }{ the interval [0,1]. {\tt hex} divides } \erritem{p. 156, l. -10} \erratum{ trignometric }{ trigonometric } See also erratum {\em p. 151, l. -4} above; there may be other misspellings of this word that I have not detected. \erritem{p. 167, l. -14} \erratum{ exended }{ extended } \erritem{p. 171, l. 13} \erratum{ trignometric }{ trigonometric } See also errata {\em p. 151, l. -4} and {\em p. 156, l. -10} above; there may be other misspellings of this word that I have not detected. \erritem{p. 181, l. 15} \erratum{ Howeve\kern-0.15em r, }{ However, } Throughout the text, terminal {\em r} letters are often, though not always, kerned too close to the preceding character. The word {\em however} frequently occurs in the text, and is usually distorted by this problem. This could indicate an error in the font dimensions for that letter, or an error in the typesetting software, or an error in the output device driver. \erritem{p. 182, l. 7} \erratum{ {\em environment\/} Pascal }{ {\em environment}. Pascal } \erritem{p. 186, l. -1} \erratum{ Chapter 9: {\tt discusses the issues in greater detail} }{ Chapter 9: {\tt } discusses the issues in greater detail } \erritem{p. 190, l. 14} {\tt char ch; \newline return (\&ch);} The code in this function, {\tt stackptr}, attempts to determine the value of the stack pointer. This code will fail on RISC machines that pass arguments in registers, a not uncommon case today (CDC mainframes in the late 1960s and early 1970s used registers this way too). \erritem{p. 194, l. 10} \erratum{ itgenerates }{ it generates } \erritem{p. 206, l. -2} \erratum{ serivce }{ service } \erritem{p. 216, l. 3} \erratum{ the macro {\tt NULL} So too does }{ the macro {\tt NULL}. So too does } \erritem{p. 217, l. -10} \erratum{ number of {\tt \char`\\} bits }{ number of bits } \erritem{p. 220, l. -12} \erratum{ A few standard type conversionsype;converting occur }{ A few standard type conversions occur } An indexing command was garbled and ended up in the text. The index on p. 496 under {\em type, converting} is consequently missing a reference to this page. \erritem{p. 221, l. -1} \erratum{ {\tt \&x-b} }{ {\tt \&x.b} } \erritem{p. 231, l. 22} \erratum{ primities }{ primitives } \erritem{p. 247, l. -14} \erratum{ equivalent to with }{ equivalent to {\tt putc} with } The wording in section~4.9.7.9 of ANSI X3.159-1989 is correct. \erritem{p. 252, l. -1} \erratum{ whether a read or write may follow }{ whether a read or write may follow. } The final item in a bulleted list should have a sentence ending period; this problem occurs elsewhere. \erritem{p. 254, l. 10} \erratum{ succintly }{ succinctly } \erritem{p. 254, ll. 23--24} \erratum{ at this point in time. }{ at this time. } Let's stamp out this relic of the doublespeak of the Nixon years. \erritem{p. 256, l. -3} \erratum{ agressively }{ aggressively } This particular spelling error occurs elsewhere; I have probably missed some instances. \erritem{p. 260, l. -13} \erratum{ pound sign ({\tt \#}) }{ sharp sign ({\tt \#}) {\em or} hash mark ({\tt \#}) } For many people in the English-speaking world, a pound sign is \pounds. Use either of the suggested phrases for an international audience. Stu Feldman in his original {\tt make} documentation wrote ``A command is any string of characters not including a sharp (except in quotes) or newline.'' I vote for sharp sign. \erritem{p. 261, l. 4} \erratum{ to generate for {\tt a} }{ to generate for {\tt a}. } The final item in a bulleted list should have a sentence ending period; this problem occurs elsewhere; see erratum {\em p. 252, l. -1} above. \erritem{p. 262, l. 5} \erratum{ per cent }{ percent } This error occurs many times throughout the book. Random House recommends ``percent'' or ``per centum''. Webster gives only ``percent''. The ANSI C Standard quoted earlier in this chapter seems to avoid naming this character at all. \erritem{p. 265, l. -5} \erratum{ either as white-space or as literal text. }{ either as white space or as literal text.\newline {\em or}\newline either as whitespace or as literal text. } The book consistently hyphenates this compound word in many places (see ll.~-2 and -3 on this page); conventional usage is to spell it as two words, or increasingly commonly, as one, with no hyphen. If the two-word form is chosen, then adjectival use demands a hyphen: {\tt white-space characters}; the single-word form eliminates that nuisance. The ANSI C Standard uses the single-word form. \erritem{p. 266, l. 14} \erratum{ conversion that follows it. }{ conversion follows it. } \erritem{p. 267, l. 8} \erratum{ F1BS$<$stdlib.h$>$ }{ {\tt } } \erritem{p. 268, l. -20} \erratum{ than digits or white-space. }{ than digits. } According to the ANSI C Standard, the caret introducing a scan set means all characters but those listed; in this example, the pattern {\tt \%[\char`\^0123456789]} should therefore match anything {\em but} digits, including whitespace. The code in {\tt \_Getfld} on p.~325 seems to implement the Standard correctly. \erritem{p. 271, l. -4} \erratum{ {\tt offset, SEEK\_CUR fseek} is more useful }{ {\tt offset, SEEK\_CUR}. {\tt fseek} is more useful } \erritem{p. 273, l. 13} \erratum{ {\bf described above.} }{ described above. } \erritem{p. 278, l. -20} \erratum{ Figure 12.xx }{ Figure 12.6 } The manuscript files should be checked for further instances of this type. \erritem{p. 283, l. -2} \erratum{ agressively }{ aggressively } This particular spelling error occurs elsewhere; I have probably missed some instances; see erratum {\em p. 256, l. -3} above. \erritem{p. 288, l. -20} \erratum{ stream is has }{ stream has } \erritem{p. 309, l. -1} \erratum{ works find. }{ works fine. } \erritem{p. 321, l. -16} \erratum{ conversion specifierconversion;specifier }{ conversion specifier } An indexing command was garbled and ended up in the text. The index on p. 478 under {\em conversion, specifier} is consequently missing a reference to this page. \erritem{p. 325, l. -13} \erratum{ only the all the lower-level functions. }{ only the lower-level functions. } \erritem{p. 329, l. 18} \erratum{ the tmpnam function }{ the {\tt tmpnam} function } \erritem{p. 353, l. -2} \erratum{ binary chop }{ binary search } \erritem{p. 372, ll. 15--16} \erratum{ It must also end of a worst-case boundary. }{ ??? } The text is sufficiently garbled, perhaps by loss of several words during editing, that I am unsure what was intended. \erritem{p. 385, l. -16} \erratum{ maintainup to eight lists }{ maintain up to eight lists } \erritem{p. 385, l. -7} \erratum{ occupy 32 bits It is }{ occupy 32 bits. It is } \erritem{p. 426, l. -9} \erratum{ See the file {\tt stdio.h"} on page 100. }{ See the file {\tt "stdio.h"} on page 100. } \erritem{p. 466, l. -4} \erratum{ {\bf file-positioning functions}function;file positioning }{ {\bf file-positioning functions} } An indexing command was garbled and ended up in the text. The index on p. 483 under {\em function, file positioning} is consequently missing a reference to this page. \erritem{p. 467, l. 22} \erratum{ avaialble }{ available } \erritem{p. 469, l. 1} \erratum{ defintion }{ definition } \erritem{p. 473, l. -13} \erratum{ {\bf unsafe macro}macro;unsafe }{ {\bf unsafe macro} } An indexing command was garbled and ended up in the text. The index on p. 487 under {\em macro, unsafe} is consequently missing a reference to this page. \erritem{p. 474, l. 8} \erratum{ with other characters }{ with other spacing characters } The distinction here is important; whitespace characters must be spacing characters that have no visible printable representation. \erritem{p. 483, l. -15, col. 1} \erratum{ functionscan 84 }{ ??? } Besides the misspelling here, I could see no obvious relation to anything on p.~84 of the book. \erritem{p. 493, l. -21} \erratum{ allcoated 349 }{ allocated 349 } This entry should then be merged into the following entry's list of page numbers. \end{errata} \end{document} % This is for GNU Emacs: % Local Variables: % fill-column: 60 % End: