Expert C Programming - Deep C Secrets
by Peter van der Linden
Expert C Programming - Deep C Secrets (complete with a fish on the cover)
is one of the most enjoyable books i've read in a long time, full of humor,
stories from the world of computing and good advice. It's written for the
programmer who knows what he's doing, but you don't have to be a C wizard
to get something out of this book. Expert C programming offers a humorous
and vivid look at C - van der Linden explains (among other things) the
difference between arrays and pointers, why programmers cant tell Halloween
from Christmas day and how to make oobleck. The book offers a variety of
topics that are poorly covered in other books, the material is the kind
that's stenciled down in the margins of good professors books, or only found in the heads of gurus.
So if you'd like to know...
.. this book is for you.
how to unscramble things like char * const *(*next)();
why extern char *a doesn't match char a in another file
how to write a basic interpreter in 25 lines of C.
Each chapter includes a "light relief" section, where van der Linden tells
some amusing and thoughtwordy story. Like this (shortened) one:
Some Light Relief - The implementation defined effect of pragmas...
When the ANSI C standard was under development, the pragma directive
was introduced. #pragma is used to convey hints to the compiler, such as
the wish to expand a certain function inline. Not previously seen in C,
pragma met with some initial resistance from a gcc implementator, who took
the "implementation defined" effect very literally- in gcc version 1.34
the use of pragma causes the compiler to stop compiling and launch a game
instead! The gcc manual contained the following:
The "#pragma" command is specified in the ANSI standard
to have an arbitrary implementation defined effect. In the GNU C Preprocessor,
"#pragma" first attempts to run "rouge", if that failed, gcc tries "hack".
As a last resort, it launches gnu emacs displaying the towers of hanoi.
If that also fails, it reports a fatal error. - manual for version 1.34
of the GNU C compiler
[ code implementating #pragma is then given.. ]
The one thing you notice is how enthusiastic the author is about programming.
He clearly loves writing code, and it shows in the book.
At the end of the book, there is a great "secrets of programmer job
interviews" appendix (it alone is worth the price of the book). In there
he asks you some fairly challenging questions: Like this favorite microsoft
question: Pick a random line from a file, all lines having an equal chance
of being selected. The problem is that you only get to do one sequential
pass though the file. Know how to do it? :)
What's bad? Not much. It could have been a little less focused on C, but it is a C book after all - and while C programmers will get the most out of Expert C Programming, any geek can enjoy it - for the fun anectocts if nothing else.
A lot of people on ./ seem to like the TOC, so here it is:
C through the mists of time
It's not a bug, It's a language feature
Unscrambling declarations in C
The shocking truth: C arrays and pointers are NOT the same
Thinking of linking
Poetry in motion: Runtime data structures
Thanks for the memory
Why programmers cant tell halloween from christmas day
More about arrays
More about pointers
You know C, so C++ is easy
Appendix: Secrets of job programmer interviews
Bathroom factor: 8/10 (you can flip to any page, and just start
reading - the only reason it doesn't get a 9 is that your bathroom visits
may become prolonged, annoying other family members)
Overall: Highly recommended (if you're proficient in C, buy it!)
Side note - this is my first attempt at doing a book review - if something sucks, tell me about it, and what i should do differently. (and don't be afraid to vote -1 on this story, if you want me to change something before posting it to the main page)