The C User's Guide to ANSIC

The C User's Guide to ANSIC

by Ken Arnold, John Peyton
     
 
e entire book; or, to get a jump start, you can scan the book for only the critical changes marked by bars in the margin. Armed with this list, you'll be prepared for all the important ANSI changes, from the critical to the truly nitpicky. You'll be alert to "quiet changes" your compiler can't warn you about, but that can make your code go radically awry. And you'll

Overview

e entire book; or, to get a jump start, you can scan the book for only the critical changes marked by bars in the margin. Armed with this list, you'll be prepared for all the important ANSI changes, from the critical to the truly nitpicky. You'll be alert to "quiet changes" your compiler can't warn you about, but that can make your code go radically awry. And you'll be aware of changes in syntax, which might require you to change your code to compile it under ANSI C.

The book covers both the language itself, including the preprocessor, and the library routines that provide runtime support. Throughout the book, wherever relevant, techniques are included for making your code compile with both pre-ANSI and ANSI compilers to accommodate systems which are not ANSI compliant.What's more, the whole subject is covered in a light, humorous tone and organized for ease of use, grouped in logical order. Readable as a book, concise as a reference, this guide will quickly get you on to doing things with the language instead of worrying about it.You return to your hometown after 10 years, finding that while many things look familiar, there are changes. You might run a stop sign that wasn't there before. Your hometown has changed and so has your C. Let Ken and John give you the tour so you don't break an axle in one of the language's new potholes.

Product Details

ISBN-13:
9780201563313
Publisher:
Addison Wesley Professional
Publication date:
01/23/1992
Series:
Professional Computing Series
Pages:
144
Product dimensions:
7.40(w) x 9.25(h) x 0.41(d)

Read an Excerpt

PREFACE:This book is designed to help current C users become proficient in ANSI C quickly. Rather than describe ANSI C completely, and expect the reader to notice what's new, we present a list of changes from the common dialects of C (K&R, BSD 4.3, System V.3, and a scattering of others) that a user of ANSI C should know about.

ANSI has changes ranging from the critical to the truly nitpicky. There are two kinds of critical changes. The most important are "quiet changes". These are changes in behavior without a change in syntax; in other words, existing code might act differently than it did under existing implementations, but the compiler can't warn you about it. Of course, some quiet changes are also unlikely to bite you, but the fact that you won't get warned by your compiler about the change in behavior makes it necessary to tell you about them anyway. The other critical changes are changes in syntax, which might require you to change your code to compile it under ANSI C.

We have split the book into two main sections, one for the language itself (including the preprocessor) and one for the library routines that provide run-time support. The language section is organized by category: tokens, the preprocessor, declarations, expressions, statements, and future directions. The library section is ordered by header file from most to least basic.

If you want to get a jump-start on ANSI C, you can scan the book for only the critical changes, which are marked by bars in the margin. However, it's a good idea to come back later and read the whole book, or you'll get bitten by something rarer or more subtle.

We also describe some techniques for making your code compile with bothpre-ANSI and ANSI compilers. Until every system in the world is ANSI compliant, many programs will have to compile on both kinds of systems. These tricks are interspersed in the text where they are relevant.

Rather than merely recite changes, we have made an effort to describe unobvious reasons for them. This is for more than historical interest; we think it will be easier to remember what has changed if you know why it has changed. It can also sometimes help eliminate frustration by letting you know that the ANSI committee sometimes had no real choice, for reasons that may not be obvious. You will be annoyed and even angered by their decisions often enough; we thought to reduce this annoyance by giving you the excuses, although you - or even we - might not think them sufficient.

Although we are trying to present the material in a small place, we have not always been able to prevent our opinions on changes from creeping in. We do not view this book as a commentary on ANSI C, rather as an explanation of it. However, our writing style is more conversational than that of many technical tomes, and sometimes we could not simply describe a particular travesty without making it clear that we did not approve. Otherwise we could never look at our reflections in the monitor again.

The book is written in the first person because only one of us was writing text at any give time. As regular readers of the C Advisor column in UNIX Review may note, the writing style is strongly Ken's. We hope you will read it anyway.

Primarily we have designed this book to be useful, rather than precise to the point of numbness; we are not reprinting the ANSI standard. We hope it is readable as a book, concise as a reference, and soon obsolete as you put this transition behind you and get on to doing things with the language instead of worrying about it. We suspect it might also make a pretty good flyswatter.

We would like to thank Steve C. Dewhurst, Patricia Giencke, Brian W. Kernighan, Douglas B. Robinson, and Clovis L. Tondo, for their diligent, helpful, and very insistent reviews. What errors remain in this book after their thorough work are hopefully insignificant, and are, in any case, completely our fault. We would also like to acknowledge Walter Murray's helpful discussions about some arcane edges of the standard. John Wait and the crew at Addison-Wesley suffered these novice authors with amazing forbearance and provided critical help and equipment. CPU cycles were supplied, in large part, by Kee Hinkley and his Amazing In-Home Computer Center.

This book would also not have been possible without the support of our families. Ken's wife, Susan D. Jones, and her mother Jill S. Jones, shouldered Ken's share of parenthood at long and odd intervals so that he could be an author when he probably ought to have been being a father. For that, and for monopolizing the home computer, he asks Jareth and Corwin's understanding (with a small bribe in the college fund department). John thanks his wife Judy for her faith and for yielding precious weekend time; also his father for his love of the mind.

Ken Arnold
John Peyton
13 October, 1991

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >