Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Paul J. Lucas

Rating No ratings yet

Don’t count C out. The classic programming language remains the backbone of many modern software systems including operating systems, relational databases, libraries, embedded systems, and even the core components of other programming languages. - This book teaches C23 while also building a foundation that strengthens your programming skills regardless of what language you normally program in. Starting with a tour of C, it highlights C’s core concepts using example programs to give you the flavor of C. Next, it covers the entire C23 language including topics not often covered elsewhere such as undefined behavior, assertions, atomic variables, lock-free programming, debugging, advanced use of the preprocessor using _Generic, and more. Finally, it gives extended examples of how features common in modern programming languages might be implemented—including lists, maps, dynamic dispatch, and exceptions. - This book includes many in-line notes containing commentary, explanations for why something is the way it is, historical context, best practices, and details often glossed over in modern languages. Additionally, it gives examples that evolve with the introduction of new language features. What You Will Learn: Write programs in C using the new features introduced in C23. Explore advanced or obscure parts of C not explained well elsewhere, if at all. See how strings, lists, maps, dynamic dispatch, and exceptions might be implemented from scratch to understand what’s really going on in whatever language you program in. Who This Book is for: Professional programmers, computer science instructors, students or experienced hobbyists who understand programming language concepts (variables, statements, loops, functions, arrays, classes, objects, etc.) and have basic familiarity with algorithm characterization given in “big O” notation.

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A practical, deep-dive guide to C23 that not only teaches the latest C standard but also reveals how core language features—strings, lists, maps, dynamic dispatch, and exceptions—are built from scratch, making it essential reading for professional programmers and students who want to understand what happens behind the curtain of modern systems. 【Book Arc】 - **Opening (~0%–9%)**: Introduces the book's mission—why C remains the backbone of operating systems, databases, and embedded systems—and sets expectations for a tour of C23, with a promise of advanced topics like undefined behavior and lock-free programming. - **Early (~17%–30%)**: Covers the fundamentals of C23 syntax and semantics, including types, operators, declarations, statements, arrays, pointers, and enumerations, with a focus on practical details like fixed-width integers, type conversions, and pointer arithmetic. - **Middle (~35%–52%)**: Delves into the preprocessor, functions, structs, unions, I/O, and program organization, then transitions into multithreading with mutexes, condition variables, and thread-local storage—building a solid foundation for concurrent programming. - **Late (~52%–end)**: Explores selected advanced topics, including undefined behavior, assertions, and atomic variables, before moving into extended examples that implement modern language features like lists, maps, dynamic dispatch, and exceptions from scratch. 【Key Takeaways】 - **C is the backbone of modern systems** (Early): Understanding C gives you insight into how operating systems, databases, and embedded systems work, making you a stronger programmer in any language. - **C23 introduces modern conveniences** (Early): New features like `typeof`, `constexpr`, and attributes (`nodiscard`, `fallthrough`) make C more expressive and safer, reducing common pitfalls. - **Pointers and arrays are deeply intertwined** (Early): Mastering the relationship between arrays and pointers—including multidimensional arrays, function pointers, and compound literals—is critical for writing efficient C code. - **The preprocessor is a powerful tool** (Middle): Beyond simple macros, advanced techniques like X macros, stringification, and concatenation enable code generation and serialization patterns that are hard to replicate elsewhere. - **Multithreading requires discipline** (Middle): C23's threading model—mutexes, condition variables, and atomics—demands careful design to avoid deadlocks and data races, with `thread_local` providing a clean way to manage per-thread state. - **Undefined behavior is a trap** (Late): Understanding what triggers undefined behavior and how compilers optimize around it is essential for writing reliable, portable C code. - **Assertions are for debugging, not error handling** (Late): Knowing when to use static and runtime assertions—and when to disable them in production—helps you catch bugs early without sacrificing performance. - **Modern features can be built from scratch** (Late): Implementing lists, maps, dynamic dispatch, and exceptions in C reveals the underlying mechanics of higher-level languages, deepening your understanding of programming language design. 【Reading Tips】 - **Skim the early chapters if you're experienced**: If you already know C basics, focus on the C23-specific additions like `typeof`, `constexpr`, and attributes, which are highlighted throughout the early sections. - **Deep-read the preprocessor and multithreading chapters**: These are the most complex and least-covered topics in other books; take time to work through the X macros and mutex/condition variable examples. - **Pay attention to the "Epilogue" sections**: Each chapter ends with a summary that reinforces key points—use these to check your understanding before moving on. - **Treat the final examples as capstone projects**: The implementations of lists, maps, dynamic dispatch, and exceptions are the payoff of the book; read them with a compiler handy to experiment. - **Don't skip the inline notes**: The author's commentary on historical context, best practices, and "why it's this way" is where the real wisdom lies—these are the details often glossed over in other references. 【Coverage Limits】 This guide is based on a stratified sample of the book's table of contents and introductory material; it does not cover the full text of every chapter, particularly the detailed code examples and the complete treatment of advanced topics like atomic operations and lock-free programming.
Excerpt 1
with algorithm characterization given in “big O” notation. Why Learn C Go Behind the Curtain of Modern Systems with C23 — Paul J. Lucas Why Learn C Paul J. ...
View in text
Page 6
. 37 2.7 Fixed-Width Integer Types . . . . . . . . . . . . . . . . . . . . . 38 2.8 Unicode Character Types . . . . . . . . . . . . . . . . . . . . . . 38 2....
View in text
Page 9
. . . . . . . . . . . . . . . . . 117 8.7.1 Parameters . . . . . . . . . . . . . . . . . . . . . . . . . 117 8.7.2 Arguments . . . . . . . . . . . . . . . . ...
View in text
Page 11
. . . . . . . . . . . . . . . . . . . . . . . . . 194 12.4.1 Formatted Reading . . . . . . . . . . . . . . . . . . . . . 194 12.4.2 String-to-Number Conversi...
View in text
Page 13
g Warnings . . . . . . . . . . . . . . . . . . . . . 276 18.8 The Curious Case of the Disappearing if . . . . . . . . . . . . . . 276 18.9 Profiling . . . . ...
View in text
Page 15
371 C.2 alignas and alignof . . . . . . . . . . . . . . . . . . . . . . . . 371 C.3 Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37...
View in text
Page 18
way it is, historical con- text, and personal opinion, i.e., things not essential for learning C, but nonethe- less interesting (hopefully), are presented as...
View in text
Page 20
Consequently, it can be too easy to write non-portable code. That is, it may work perfectly on your machine, but if compiled and run on another machine, it m...
View in text
Tags
AI categories
ProgrammingProgramming Language
ISBN: 8868815966
Publisher: Apress
Publish Year: 2025
Language: English
Pages: 414
File Format: PDF
File Size: 11.4 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…