Portability


The Annotated ANSI C Standard

reviewed by P.J. Plauger


P.J. Plauger is senior editor of The C Users Journal. He is convenor of the ISO C standards committee, WG14, and active on the C++ committee, WG21. His latest books are The Standard C Library, and Programming on Purpose (three volumes), all published by Prentice-Hall. You can reach him at pjp@plauger.com.

If you really take your portable C seriously, there's no substitute for a handy copy of the C Standard. It is, by definition, the last word on what's valid Standard C and what's not. Unfortunately, you have to shell out roughly $65 or more (last time I asked) to either ANSI in New York City or ISO in Geneva to get a copy. And what you get for your money is a couple hundred pages of dense legalese. (We who wrote the C Standard also provided a Rationale, but that got dropped somewhere along the road to approval.)

When I wrote The Standard C Library (Prentice Hall, 1992), I had the devil's own time getting permission to reprint about half the C Standard. ANSI has been struggling for years to work out a reasonable policy for granting reprint rights to their programming language standards, which have been growing steadily and rapidly in commercial importance. They just plain didn't have their act together when I asked. ISO was a bit better off, but still ill prepared to deal with the more complex standards that we programmers care about. Eventually, I got my permission from ISO, but I'm still not sure how.

Now it seems that Osborne McGraw-Hill has also managed to strike a reprint deal, this time with ANSI. They offer this complete and verbatim edition of the ANSI/ISO C Standard for a mere $39.95 list price. Not only that, they provide considerable running commentary as well. The latter takes the form of annotation supplied by Herbert Schildt, one of the more prolific authors in the realm of C and C++ "how 2" books.

You run a slight risk in using a derived standard such as this one. I had to convert Dave Prosser's troff master into a form digestible by Ventura Publisher. In the process, I introduced a number of typographical errors, mostly trivial formatting botches. A cursory scan of Osborne's opus has so far turned up only one typo. Far worse, however is the duplication of page 131 in place of page 132, which blows a nasty whole in the middle of fprintf. Those two botches make a prima facie case that the reproduction is not assuredly perfect. Still, they seem to have preserved the pagination of the official standard, and they have certainly done a tidier job than I did with my subset. I wouldn't stake my career on this book being right, but I'd probably trust it to settle most bar bets.

Schildt's annotation is the real value added, and it's pretty good. Mostly I feel he draws attention to the right sorts of ancillary issues, and he has a fairly sensible perspective on the C Standard. You can usually count on him to tell you what the words mean and not just what they say.

His annotation is somewhat compromised by the constraints of the presentation — pages from the C Standard are on the left, his commentary is on the right. He's not above continuing a comment onto a subsequent page, but you can still see the brakes being applied rather often. Many of his comments and illustrations are terse or barely commented to stay roughly in sync with the standardese.

In a few places, I find the annotation excessively terse. Schildt says little about the math functions, even though any number of them could profit from just a sentence or two. (frexp and ldexp are two that spring to mind.) True, many of these functions are ones that only a mathematician could love, but I still find rather laconic the assertion, "The descriptions of the hyperbolic functions are straightforward and need no further comment." Similarly, the functions in <locale.h> get only a cursory treatment, not that I can blame the guy for copping out here.

More generally, Schildt endeavors to say at least something on each topic to aid understanding. I don't always agree with what he chose to say, but mostly I feel he says something helpful. Only occasionally did I catch him out. For example, his description of storage classes, a notoriously involuted topic, contains the usual errors of oversimplification. And his recitation of the history of register is slightly incorrect and incomplete. But as a rule, I think you will be more enlightened than misled by the annotations in this book.

So if you've always wanted your own copy of the C Standard, here's your best chance. Not only do you get a reasonably accurate facsimile of the gospel at bargain rates, you get some helpful commentary in the bargain. That makes this book a better than average buy.

Title: The Annotated ANSI C Standard
Author: annotated by Herbert Schildt
Publisher: Osborne McGraw Hill, 1990
Price: $39.95
ISBN: 0-07-881952-0
Pages: 600