Throw out your old ideas about C and get to know a programming language that’s substantially outgrown its origins. With this revised edition of 21st Century C, you’ll discover up-to-date techniques missing from other C tutorials, whether you’re new to the language or just getting reacquainted.
C isn’t just the foundation of modern programming languages; it is a modern language, ideal for writing efficient, state-of-the-art applications. Get past idioms that made sense on mainframes and learn the tools you need to work with this evolved and aggressively simple language. No matter what programming language you currently favor, you’ll quickly see that 21st century C rocks.
Set up a C programming environment with shell facilities, makefiles, text editors, debuggers, and memory checkers
Use Autotools, C’s de facto cross-platform package manager
Learn about the problematic C concepts too useful to discard
Solve C’s string-building problems with C-standard functions
Use modern syntactic features for functions that take structured inputs
Build high-level, object-based libraries and programs
Perform advanced math, talk to internet servers, and run databases with existing C libraries
This edition also includes new material on concurrent threads, virtual tables, C99 numeric types, and other features.
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
【One-Line Pitch】
A modern re-introduction to C for programmers who learned it the old way—or never learned the new way—covering the toolchain, debugging, packaging, and the C99/C11 features that make C pleasant again. Best for working developers who want to write efficient, portable, maintainable C rather than mainframe-era idioms.
【Book Arc】
- **Opening (~0%–15%)**: Frames the book's thesis—C has outgrown its origins and deserves modern tooling and syntax—then walks through setting up a real environment: compiler, debugger, memory checker, profiler, and the shell/make conventions that glue them together.
- **Early (~15%–35%)**: Establishes the historical arc from K&R through ANSI C89 to today, then moves into practical build mechanics: linking libraries (e.g., `-lm`), using shell variables and makefiles, and pulling in libraries from source when you lack admin rights.
- **Middle (~35%–55%)**: The debugging and quality chapter—GDB/LLDB workflows (stepping, inspecting structures, thread awareness), unit testing with fixtures, and error-handling macros like `Stopif` that let callers choose to abort or recover.
- **Late (~55%–80%)**: Packaging and collaboration: Autotools as C's de facto cross-platform packaging system, revision control, and the discipline of distributing code others can actually build.
- **Ending (~80%–100%)**: The modern-language payoff—string handling with `asprintf`/`strtok`/Unicode, better structures via compound literals, designated initializers, variadic macros, typedefs, and flexible function inputs, plus new material on threads, virtual tables, and C99 numeric types.
【Key Takeaways】
- **C is a modern language, not a historical artifact** (Opening): The book's core argument is that C99/C11 and contemporary tooling make C competitive for state-of-the-art applications; the "mainframe idioms" you inherited are optional, not mandatory.
- **Your environment is part of the language** (Early): Compiler, linker flags, shell variables, and makefiles aren't incidental—they determine whether your code builds portably. Understanding `-lm`, `CFLAGS`, and `export` is as important as syntax.
- **Debugging is a skill you practice, not a last resort** (Middle): GDB/LLDB techniques—frame navigation, `$` convenience variables, printing structures, checking threads—turn debugging from guesswork into a repeatable method.
- **Error handling deserves a macro, not scattered `if` blocks** (Middle): Since the standard library offers only `assert`, the book shows how to build a `Stopif`-style macro that reports or records errors and lets the user decide whether to stop or continue.
- **String handling in C is solvable** (Late): `asprintf` and related standard functions address the classic pain of building strings, with attention to security and constant strings; Unicode gets its own treatment.
- **Modern syntax makes structured data ergonomic** (Late): Compound literals, designated initializers, zero-initialization, and typedefs let you pass and return structured inputs cleanly—including returning multiple items and reporting errors from one function.
- **Flexible function interfaces are a design choice** (Late): Variadic macros, safely terminated lists, `printf`-style declarations, and optional/named arguments show how to polish a dull function into a usable API.
- **Concurrency and object-based design are in scope** (Ending): The revised edition adds threads and virtual tables, signaling that C can support higher-level, object-based libraries without abandoning its simplicity.
【Reading Tips】
- **Skim Part I if you already have a working toolchain**: The environment, makefile, and debugger chapters are reference material—return to them when a build or debugging problem actually bites.
- **Deep-read the error-handling and string chapters**: The `Stopif` macro pattern and `asprintf`/`strtok` discussion are the highest-leverage, most reusable ideas in the book.
- **Treat the debugger chapter as a lab, not a lecture**: Type the GDB/LLDB commands as you read; the `$` convenience-variable tricks and structure-printing macros only stick through repetition.
- **Don't skip the packaging chapter even if you work solo**: Autotools and revision control are framed as collaboration tools, but the discipline improves solo projects too.
- **Watch for the new-edition material**: Threads, virtual tables, and C99 numeric types are flagged as additions—if you read the first edition, these are the sections worth revisiting.
【Coverage Limits】
These excerpts cover the book's structure, preface, and early-to-middle chapters in detail, but the later chapters (string handling, structures, object-based libraries, math/networking/database libraries) are represented mainly by table-of-contents entries and brief mentions. Specific code examples and arguments from those chapters are not fully visible here.
Excerpt 1
icient, state-of-the-art applications. youasitdidinthe'90s? Get past idioms that made sense on mainframes and learn the tools you BenKlemenscapably need to w...
software developers, web designers, and business and crea‐ tive professionals use Safari Books Online as their primary resource for research, problem solving...
ow it distinguishes between the assignment and the command. Using this form sets and exports the given variables for one line only. After you try this on the...
user decide whether to stop on errors or move on (stopif.h) #include <stdio.h> #include <stdlib.h> //abort /** Set this to \c 's' to stop the program on an e...
e’ve just changed the work I have to do from inspecting the various platforms to writing configuration files for Autoconf and makefile templates for Automake...
tion to be made. For example, given a function declared via int f(int *a_pointer, int an_array[]); a_pointer and an_array behave identically. No memory is be...
roblems with const so that you can surmount them. As liter‐ ature goes, it isn’t all that problematic, and the recommendation that you add const to your func...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
21st Century C C Tips from the New School (Ben Klemens)(Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
21st Century C C Tips from the New School (Ben Klemens)(Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
Loading comments...
Reply to Comment
Edit Comment