Synopses & Reviews
Throw out your old ideas of C, and relearn a programming language thats substantially outgrown its origins. With 21st Century C, youll discover up-to-date techniques that are absent from every other C text available. C isnt just the foundation of modern programming languages, it is a modern language, ideal for writing efficient, state-of-the-art applications. Learn to dump old habits that made sense on mainframes, and pick up the tools you need to use this evolved and aggressively simple language. No matter what programming language you currently champion, youll agree that C rocks.
- Set up a C programming environment with shell facilities, makefiles, text editors, debuggers, and memory checkers
- Use Autotools, Cs de facto cross-platform package manager
- Learn which older C concepts should be downplayed or deprecated
- Explore problematic C concepts that are too useful to throw out
- Solve Cs string-building problems with C-standard and POSIX-standard functions
- Use modern syntactic features for functions that take structured inputs
- Build high-level object-based libraries and programs
- Apply existing C libraries for doing advanced math, talking to Internet servers, and running databases
If you know how to program with a general purpose language such as Ruby or Python, you can also learn how to use the C language in a practical and modern style. However, you need many techniques that are entirely absent from every C textbook on the market—except this one. 21st Century C assembles all the tools you need to write efficient, state-of-the-art programs with C.
Youll get to know the facilities of your shell, makefiles, fabulous text editors, debuggers, and memory checkers as well as tips that exhort you to throw out the tools that primarily made sense on the mainframes of old, such as the switch statement or the dreaded malloc().
About the Author
Ben Klemens is the author of Modeling with Data (Princeton Press), which is his second book. It is a textbook about scientific and statistical computing, including a heavy focus on how statistical models are built and actually evaluated on a computer. The book has a long C tutorial, but its not a C textbook. He wrote the this book while doing various contracts, such as designing micro-simulations of migration at the Brookings Institute and the World Bank, and finding genes 4 correlated to bipolar disorder at the NIMH.Before that, his first book, Math You Cant Use: Patents, copyright, and software (Brookings Press), was about the expansion of patent law into the realm of software. Shortly after the book came out, he was the Executive Director of the Free Software Foundations End Software Patents campaign, which he ran for about a year.
Table of Contents
Preface; C Is Punk Rock; Q and A (Or, the Parameters of the Book); Standards: So Many to Choose From; Some Logistics; Content Updates; The Environment; Chapter 1: Set Yourself Up for Easy Compilation; 1.1 Use a Package Manager; 1.2 Compiling C with Windows; 1.3 Which Way to the Library?; 1.4 Using Makefiles; 1.5 Using Libraries from Source; 1.6 Using Libraries from Source (Even if Your Sysadmin Doesn't Want You To); 1.7 Compiling C Programs via Here Document; Chapter 2: Debug, Test, Document; 2.1 Using a Debugger; 2.2 Using Valgrind to Check for Errors; 2.3 Unit Testing; 2.4 Interweaving Documentation; 2.5 Error Checking; Chapter 3: Packaging Your Project; 3.1 The Shell; 3.2 Makefiles vs. Shell Scripts; 3.3 Packaging Your Code with Autotools; Chapter 4: Version Control; 4.1 Changes via diff; 4.2 Git's Objects; 4.3 Trees and Their Branches; 4.4 Remote Repositories; Chapter 5: Playing Nice with Others; 5.1 The Process; 5.2 Python Host; The Language; Chapter 6: Your Pal the Pointer; 6.1 Automatic, Static, and Manual Memory; 6.2 Persistent State Variables; 6.3 Pointers Without malloc; Chapter 7: C Syntax You Can Ignore; 7.1 Don't Bother Explicitly Returning from main; 7.2 Let Declarations Flow; 7.3 Cast Less; 7.4 Enums and Strings; 7.5 Labels, gotos, switches, and breaks; 7.6 Deprecate Float; 7.7 Comparing Unsigned Integers; Chapter 8: Obstacles and Opportunity; 8.1 Cultivate Robust and Flourishing Macros; 8.2 Linkage with static and extern; 8.3 The const Keyword; Chapter 9: Text; 9.1 Making String Handling Less Painful with asprintf; 9.2 A Pæan to strtok; 9.3 Unicode; Chapter 10: Better Structures; 10.1 Compound Literals; 10.2 Variadic Macros; 10.3 Safely Terminated Lists; 10.4 Foreach; 10.5 Vectorize a Function; 10.6 Designated Initializers; 10.7 Initialize Arrays and Structs with Zeros; 10.8 Typedefs Save the Day; 10.9 Return Multiple Items from a Function; 10.10 Flexible Function Inputs; 10.11 The Void Pointer and the Structures It Points To; Chapter 11: Object-Oriented Programming in C; 11.1 What You Don't Get (and Why You Won't Miss It); 11.2 Extending Structures and Dictionaries; 11.3 Functions in Your Structs; 11.4 Count References; Chapter 12: Libraries; 12.1 GLib; 12.2 POSIX; 12.3 The GNU Scientific Library; 12.4 SQLite; 12.5 libxml and cURL; Epilogue; Glossary; Bibliography; Colophon;