Expert C Programming: Deep C Secrets 1st Edition
Use the Amazon App to scan ISBNs and compare prices.
Enter your mobile number or email address below and we'll send you a link to download the free Kindle App. Then you can start reading Kindle books on your smartphone, tablet, or computer - no Kindle device required.
To get the free app, enter your mobile phone number.
Frequently bought together
Customers who viewed this item also viewed
From the Back Cover
This is a very different book on the C language! In an easy, conversational style, Peter van der Linden, of Sun's compiler and OS kernel group, presents dozens of astonishing examples drawn from practical experience, including:
- Software that blew up the space probe to Venus
- The C bug that shut down the entire AT&T phone system
- C programmer job interview secrets
- Why programmers can't tell Halloween from Christmas day
- The C code for a complete BASIC interpreter
Expert C Programming reveals the coding techniques used by the best C programmers. It relates C to other languages, and includes an introduction to C++ that can be understood by an programmer without weeks of mind-bending study. Covering both the IBM PC and UNIX systems, it is an entertaining and educational romp through C showing how experts really use it. Expert C Programming is a must read for anyone who wants to learn more about the implementation, practical use, and folklore of C.
"Not just clearly written, but fun to read. The tone and style of this text should make this a popular book with professional programmers. However, the tone of this book will make it very popular with undergraduates. Appendix A alone would make the purchase of this book a must. It's filled with great advice."
Professor Jack Beidler, Chairman, Department of Computer Science, University of Scranton
"So that's why extern char *cp isn't the same as extern char cp. I knew that it didn't work despite their superficial equivalence, but I didn't know why. I also love the job interview test questions on C."
David S. Platt, Rolling Thunder Computing
"In Expert C Programming, Peter van der Linden combines C language expertise and a subtle sense of humor to deliver a C programming book that stands out from the pack. In a genre too often known for windy, lifeless prose, van der Linden's crisp language, tongue-in-cheek attitude, and real-world examples engage and instruct."
John Barry, author of Sunburst, Technobabble, and other books
There was a problem filtering reviews right now. Please try again later.
The Good: Dennis Ritchie, in his essay on "The Development of the C language", wrote that "Two ideas are most characteristic of C among languages of its class: the relationship between arrays and pointers, and the way in which declaration syntax mimics expression syntax." In the book under review, van der Linden is at his finest when discussing precisely these two topics. Starting with arrays & pointers: the book includes 3 chapters on the subject, first tackling the classic "defined as array / external declaration as pointer" problem. Later, the author returns to the root of the confusion, namely that even though arrays and pointers are distinct entities in declarations/definitions, there is one major exception: a function can have an array parameter, but the argument will be converted to a pointer before the call (though this rule isn't recursive). As a result, even though arrays are not modifiable lvalues, you can use assignment inside a function since the argument will have been converted to a pointer. Leaving declarations behind us, the story gets more elaborate: i) when used in an expression an array name is converted to a pointer, and ii) a subscript is always equivalent to an offset from a pointer. Of course this is too straightforward, so the first point does not apply when the array "is the operand of the sizeof operator or the unary & operator, or is a string literal used to initialize an array" (184.108.40.206) -- C1X adds the _Alignof operator to this list. Moving on to Ritchie's second characteristic idea, the relationship between declaration syntax and expression syntax: van der Linden has one chapter on this subject, providing a very useful algorithm (in two versions) that allows one to untangle virtually any possible declaration (though it would have been nice if he had also mentioned "go right when you can, go left when you must"). He then applies this algorithm to the signal library function (sigaction's prototype was presumably too simple). In this connection, the author makes the interesting observation that the addition of const and volatile to ANSI C led to a reduction of the number of cases in which the use of a variable mimics its declaration. In a later chapter he makes a similar point regarding calls to a function and calls to a function through a pointer (or any level of pointer indirection). These are only two examples of van der Linden's non-hagiographic attitude: he devotes an entire chapter to the aspects of C he doesn't like (C's "sins of commission, sins of omission, and sins of mission" as he calls them), bringing to mind Matthew Wilson's later volume "Imperfect C++". The author's choice of words in this case ("sins of mission") reflects his wider approach to writing: his style is relaxed and often funny (more so in the early chapters). For example, he quotes Peter Weinberger (of awk fame) as saying: "All C programs do the same thing: look at a character and do nothing with it". Finally, the book does contain a number of other insights/techniques from various aspects of C programming, some important and relatively obvious (e.g. to implement a finite-state machine in C you probably need an array of pointers to functions), others considerably less so (e.g. the typedef keyword doesn't have to appear at the start of a declaration!).
The Bad: starting with big-picture issues, it's worth pointing out that the title is somewhat misleading. The book under review is better described by its subtitle "Deep C Secrets" (pun notwithstanding), as what it mainly covers are C's dark corners. Still on the theme of what a book with this title should or shouldn't include: the middle chapters (on the runtime system and on memory) are very clear and interesting, but most of this material can already be found in any undergrad Operating Systems textbook (minus the SunOS bent). While it is true that a skilled C programmer should know this stuff, these chapters are nowhere near expert-level. On a different note, the book is showing its age. Its datedness has secondary consequences (e.g. repeated references to MS-DOS and one mention of "machines on the Internet network") but also substantive repercussions. As this book came out in 1994, it doesn't contain anything on C99, therefore no bool, inline, restrict, static and type qualifiers in parameter array declarators, or any of the other features. Interestingly, van der Linden does mention that at the time people were talking about adding a complex number type to C: this was added in C99, but it looks like it's going to become optional in C1X. Similarly, he laments the fact that gets was included in C89: it was deprecated in C99 and will be removed in C1X. As could be expected, the C++ chapter is even more temporally bound. The text also suffers from a few minor issues which ordinarily wouldn't be worth noting, but seem out of place in a detail-oriented book whose author and publisher have had 17 years to fix up lesser faults. For example, terms like "data segment" and "text segment" are thrown around in the first half of the book but are only introduced in chapter 6 (of 11). At an even more fine-grained level, the order of expression evaluation is said to be unspecified on p. 48 though it was undefined only a page earlier. Another category of minor problems has to do with issues that were mangled in later reprints despite the errata list. First, on p. 80 the early part of the section title on "typedef x int and #define x int" was silently changed between printings (i.e. without an entry on the errata page) to "typedef int x". This raises new issues which are also not discussed in the main text: the macro expansion leads to an invalid declaration, but now the typedef is legal. Second, p. 205 used to say "the automatic promotion of a character literal causes it to become an int", but in a later printing this was changed to "character literals have type int and they get there by following the rules for promotion from type char" which is obfuscatory at best. In reality, character literals (officially called "character constants") have type int because the standard says so: "An integer character constant has type int" (220.127.116.11). [As an aside, this is one of the incompatibilities between C and C++ mentioned by van der Linden on p. 326.]. Finally, the book's index is hopeless: e.g. there's an entry on Fortran and a separate one on Fortran 90, but no entries on functions or structs.
Readers who are searching for a "second book on C" with lots of insights on design should probably look at David Hanson's "C Interfaces and Implementations", as "Expert C Programming" doesn't really discuss large-scale software construction. Also, this book does suffer from a pro-Sun/anti-Microsoft bias and it does contain some outdated material. However, a finite fraction of the C community still uses C89/C90 exclusively, so for readers who want to study not-so-often examined aspects of C this text is irreplaceable (despite minor problems here and there). All in all, 4 stars.
I wish there existed many more books in the style of Peter Van Der Linden's.
C Language is brilliant and distinct from C++, each has it's strengths and weaknesses. For example, C Language has a transparency - what you read in the source is what happens at runtime.
Take this book for a test drive.
This is a book presents the strengths of C Language and where they have had the most impact. As a result of reading this book I understand C Language much better. I also understand C++ better - because I have some additional context for why C++ adds a feature, deprecates (or discourages rather) a feature.
I enjoyed Peter's humor (sometimes laugh out loud, which makes anyone raise their eyebrow when they see the book title) and writing style. It was a very delightful text to read.
This book is an absolute must have for anyone that programs in C (as a second book on the subject). It should be required reading for anyone that teaches a course on C programming.
Top international reviews
It is also a fun read, which is somehow impressive considering it is a programming book.
Peter? What about a second edition which covers C99 and C11?
Il libro non insegna la sintassi del linguaggio o gli aspetti in comune con altri linguaggi, cose che si possono anche imparare facilmente in autonomia, ma piuttosto entra nel dettaglio dei vari aspetti dello standard, specificando cosa è standardizzato e cosa invece può dipendere dal compilatore, cosa accade in situazioni impreviste quando tutto sembra corretto e invece non va, errori comuni, cosa succede usando con leggerezza alcuni aspetti del linguaggio, le differenze tra espressioni che a prima vista sembrano equivalenti, propone domande che a confronto Marzullo sembra un dilettante, ecc ecc... tutto andando a cercare il pelo nell'uovo.
Credetemi sulla parola, la stragrande maggioranza di coloro che credono di conoscere già il C rimarranno a bocca aperta leggendo questo testo. E' un'opera incredibile che raccoglie e racchiude l'esperienza e la competenza dell'autore e che obbligherei ogni studente universitario di informatica a studiare.
Se state guardando questa pagina, con ogni probabilità avete già abbastanza motivi per comprare questo libro, quindi compratelo e basta.
Libro a parer mio splendido, certo in alcuni punti risulta evidente la sua veneranda età, tuttavia i punti di forza sovrastano di gran lunga taluni paragrafi datati che alla lunga passano in secondo piano. Le sezioni che ho gradito maggiormente per la chiarezza espositiva sono state sicuramente quelle inerenti puntatori e gestione della memoria, linking compreso, ma diciamo che sostanzialmente ho apprezzato ogni pagina del testo.
Es gibt jedoch mehrere Punkte die negativ auffallen. Mit manchen von ihnen kann man durchaus leben, manche sind jedoch in meinen Augen schwerwiegend:
1) Die Schrift, die von anderen kritisiert wird, ist eines Prentice Hall Namens tatsächlich nicht würdig. Stellenweise verblasst, unscharf und erinnert mehr an die Qualität eines Nadeldruckers aus dem Jahre 1988. Problemlos leserlich ja, jedoch qualitativ sehr bescheiden.
2) Das Buch sollte eigentlich "Semi-Expert ANSI C Programming" heissen. Denn ANSI C/ISO 90 ist die Grundlage dieses Buches. Dies wäre ehrlicher, dem Buchabsatz heutzutage aber eher hinderlich. Erstens kenne ich keinen C Experten der 2019 noch strikt ANSI-konform programmieren würde, zweitens hat sich seit 1994 (Stand auf den sich das Buch bezieht!) doch einiges getan, so dass man dem Buch attestieren muss, stellenweise veraltet zu sein.
3) Es gibt neuere Standards und es gibt zahlreiche (zugegeben implementierungsabhängige) Erweiterungen, so dass gewisse Behauptungen im Buch einfach nicht mehr zutreffen (oder aufgrund des Datums nicht zutreffen können), wenn man generell von "C" spricht. "Nested functions" sind in GNU C seit geraumer Zeit möglich, genauso wie "variable size arrays" und "local labels". Weitere praxisrelevante Erweiterungen wie "obstacks" oder "halbautomatische memory-allocation" finden ebenfalls keine Beschreibung.
4) Der Stoff ist mit Anekdoten, historischen Pannen und Kommentaren ausgeschmückt, aus heutiger Sicht nicht immer "politisch korrekt" (errinnert an den alten fortune Sprücheklopfer), jedoch unterhaltsam und sehr lehrreich. Erwähnungen von gcc 1.34, OS/2, MS-DOS, lint, etc. sind ebenfalls lustig und bedürfen keiner weiteren Ausschmückung.
5) Der Stoff ist über weite Strecken sehr gut aufbereitet, in manchen Fällen jedoch unvollständig. Um sich "Experte" zu nennen, reicht es nicht die Rangordnung von 3-4 Operatoren/Klassen zu kennen, es gibt schliesslich ganze 15 davon. Dem "inline assembler code" wird kaum eine halbe Seite gewidmet, dem "obfuscated" winner aus dem Jahr 1988 dafür ganze 5. Dass statische libraries keine Relevanz mehr besitzen, ist gerade im Zeitalter der "embedded systems" oder "IoT" auch nur eine halbe Wahrheit. Weiters finden sich zahlreiche Beispiele die man absichtlich mit dem Hinweis "man solle es selbst herausfinden" nicht erklärt bekommt. Ein Kapitel (11) beschäftigt sich ausschliesslich damit, C++ zu verdammen. Ob berechtigt oder nicht, vollkommen fehl am Platz, denn beide Sprachen habe soviel gemeinsam wie Pringles und ein Kartoffelsack.
Fazit: Wer so ANSI C programmieren möchte, wie man es Mitte der 90-er tat, dem ist das Buch ohne Einschränkungen zu empfehlen. Wer nicht, der muss wohl mit der Tatsache leben, nach Durchlesen höchstens ein Halbexperte geworden zu sein, denn das Expertenzertifikat am Ende des Buches ist explizit auf das 20-te Jahrhundert beschränkt :-)