indexC from the Metal#c#undefined-behavior#types#c-layer

C from the Metal

You already know how to program. C doesn't teach you that — it removes the safety net and hands you the machine. This branch is about the parts of C that surprise an experienced engineer coming from a managed language: a type system that barely checks anything, undefined behavior that the compiler exploits, a textual preprocessor, arrays that quietly become pointers, and a standard library that assumes you know what you're doing.

C is a thin, leaky abstraction over the hardware. That's its power and its danger: there is almost nothing between your source and the instructions, so every guarantee you used to lean on is now your job.

Planned notes

Core sources

  • Jens Gustedt — Modern C (free PDF) — the spine; teaches C as it should be written today. gustedt.gitlabpages.inria.fr/modern-c
  • Kernighan & Ritchie — The C Programming Language (K&R) — the canonical, terse original.
  • Robert Seacord — Effective C — modern, security-minded C.
  • Peter van der Linden — Expert C Programming: Deep C Secrets — the gold mine of quirks and UB.
  • Beej's Guide to C — friendly and free. beej.us/guide/bgc · cppreference (C) — the reference. en.cppreference.com/w/c

Connects to: Machine Model · Pointers & Memory · Assembly & Compiler Output