REVIEW - Effective C - An Introduction to Professional C Programming


Title:

Effective C

An Introduction to Professional C Programming

Author:

Robert C. Seacord

Publisher:

No Starch Press (2020)

Pages:

272pp

Reviewer:

Ian Bruntlett

Reviewed:

March 2021

Rating:

★★★★★


Verdict: Highly recommended.

I approached this book from the perspective of a C programmer who has programmed in K&R C and C89. I wanted to see what had changed since then and, perhaps, what has happened to the tools available.

It is a fairly accomplished description of the language – there were parts, though, that I read that described things I already knew but found difficult to follow – I found the language of the book a bit ‘wordy’ in parts and better examples and a few extra diagrams would have improved this book. A few changes would have made this book a better initial reference – highlighting gotchas, an overview of the different parts of the standard library and a glossary. The examples are typically fragments – if they had been complete examples which could be typed in and experimented with – or even downloaded and played around with – this would have been a better book for the more inexperienced reader. And there is the occasional typo in the examples.

This book is more up to date than The C Programming Language (2nd Edition). The examples are not as good as that book but, on the other hand, not everyone can write as well as Kernighan and Ritchie. But, this book is more up to date, introduces terminology used by the C standard, has a whole chapter on Program Structure and mentions more tools. It does refer the reader to the C standard but forgets to tell the reader about links to the C draft standard which would have been helpful. Also, the website https://en.cppreference.com/w/c/language is mentioned as a useful reference but, I feel not mentioned enough. Whilst Threads and Atomics are mentioned, they are not covered – no reference given as to where to learn more. I feel this is a pity because these topics are important these days.

The ‘Characters and Strings’ chapter goes way beyond ASCII. Various character sets are mentioned – Unicode, UTF-8 etc and the Bibliography has a link to the rather useful UTF-8 and Unicode FAQ for Unix/Linux: https://www.cl.cam.ac.uk/~mgk25/unicode.html

Over time, common errors have been noticed in C programs. Many string and memory handling functions are too easily misused. Special safe (yet optional!) variants of strcpy etc are mentioned. I would very much like those functions to be made a required part of the language. Handling Dynamically Allocated memory is covered, along with the use of Gray Watson’s debug memory allocation library (DMALLOC) to debug your programs that use malloc and its siblings.

There are two chapters – ‘Program Structure’ and ‘Debugging, Testing, and Analysis’ that stand out to me as something special, especially for the novice developer.

The ‘Program Structure’ chapter has an interesting multi-file program to type in and experiment with. I think either coverage of Make or more complete coverage of CMake would have been helpful. It does try to be platform-agnostic – covering Windows and *nix tools and command line options.

The ‘Debugging, Testing, and Analysis’ chapter is full of useful information on static and dynamic analysis tools. K&R, notably, did not even mention lint. This chapter more than does that, covering assert, static_assert, useful (GCC/Clang/Visual C++) compiler settings and flags, Google Test for unit testing (albeit at the complication of using C++ to test C code), AddressSanitizer and a little mention for CMake.

To conclude: A worthwhile addition to a C programmer’s bookshelf.

Website robertseacord.com/wp






Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.