Hacktical C: practical hacker's guide to the C programming language
Microsoft’s C Compiler and Standards Support
- Discussion distinguishes MSVC’s strong C++ support from historically weak, lagging C support.
- MSVC only fully adopted C11/C17 (minus VLAs) around 2020; VLAs are explicitly not planned.
- There is no clear roadmap for C23, while GCC already defaults to it.
- Some link this to Microsoft’s current security focus and strategic shift toward Rust/managed languages, suggesting C23 in MSVC may never arrive.
- Others note Clang is “blessed” in Visual Studio, so missing C features can be obtained via Clang instead.
Memory Safety, Rust, and Safety Culture
- Several comments argue that “stricter” languages don’t just reduce but can eliminate entire classes of bugs in safe code.
- However, unsafe regions and broken invariants can reintroduce UB even in languages like Rust; the notion of “sound” libraries is emphasized.
- There’s debate over whether focusing heavily on memory safety is worth the complexity versus “making C safer” with tools, guidelines, and culture.
- Tools like Coq, model checking, fuzzers, sanitizers, and MISRA are cited as heavy but necessary machinery to reach comparable confidence in C.
C as “Portable Assembler” vs High‑Level Language
- One camp views C as a “mostly portable assembler” that stays close to the hardware and offers maximum freedom.
- Others argue you actually target the C abstract machine, not real hardware, and that many hardware capabilities (SIMD, calling conventions, bit‑twiddling idioms) are poorly modeled.
- Multiple commenters point out that truly hardware-accurate work belongs in assembly; C is low-level relative to modern languages but historically classified as high level.
Freedom, Undefined Behavior, and Practicality
- C is praised for “not getting in your way,” but others respond that it makes memory-safe code difficult and relies on UB for performance.
- Examples: strict aliasing, signed overflow, reading uninitialized data, NULL with memcpy, and data races all being UB and often surprising.
- Some recommend compiling with minimal optimization (e.g., -O0) to avoid aggressive UB exploitation, while others call this unrealistic.
Coroutine and Macro Tricks
- The book’s coroutine macro using
case __LINE__is called “diabolical” but clever; some reference classic coroutine articles as inspiration. - Alternatives using GNU extensions and labels-as-values are mentioned, though their “simplicity” is debated.
- There’s side discussion on multiline macros and potential future C standard enhancements.
Critiques of the Book’s Technical Content
- Strong criticism of the “fixed‑point” section: commenters assert it actually implements a decimal float with exponents, not true fixed-point, and that the operations are incorrect except for trivial exponents.
- The ordered-vector-as-map/set design is attacked as slower and more complex than a straightforward hash table; claiming it avoids “months of hash research” is seen as unconvincing.
- Some readers conclude the work is “riddled with errors” and are put off by the author’s dismissive response to technical criticism.
C vs C++ and Object‑Like Patterns
- One view: if you’re building method tables with structs + function pointers, you might as well use C++ classes as “C with classes.”
- Pushback: C++ introduces unwanted complexity (exceptions, RTTI, templates) and lacks some C features (VLAs, variably modified types).
- Optional operations (like filesystem VFS callbacks) are cited as an area where C-style function pointer tables are simpler than trying to model “optional methods” with C++ virtual functions.
- Others note you can approximate this in C++ with templates, concepts, or custom querying, but it becomes intricate.
Miscellaneous
- Some object to the book’s framing that people choosing safer languages “don’t trust themselves with C,” seeing it as hubristic.
- The “hacker” in the title is clarified as “practical, curious problem solver.”
- A few practical notes: pandoc + xelatex can generate a PDF; BSDs are recommended by some as excellent C hacking environments due to stability and documentation.