Topic
Everything filed under C, newest first.
RSS · JSON · All topics
C's designated initializers give us named arguments
Arthur O'Dwyer shows a pattern from Ben Klemens' 21st Century C that uses C's full designated initializers and a variadic macro to give functions named, defaultable arguments, and discusses its ABI and library-design tradeoffs.
3 min · 775 words
Why Zig Over C for Systems Programming
Mihalis Tsoukalos walks through what C gets right, the parts of C that cost him time, and how Zig addresses them with comparable low-level control, no runtime, and compiler and debug-mode checks that catch mistakes C lets through.
7 min · 1,565 words
Linux distributions and package managers audit built binaries for non-relocatable absolute paths with grep or strings, but with GCC on x86-64 string constants are often split into immediate-value pieces, so those checks miss embedded build paths.
6 min · 1,483 words
Memory management in 40 major C projects, a survey
Phil Eaton surveys how 40 major C projects allocate memory: only 8 use malloc/free alone, only 2 never use it, 15 use regions at some point, 7 primarily use regions, 5 primarily use garbage collection and 3 primarily use reference counting.
5 min · 1,090 words
Ben Andrew traces what glibc's malloc actually does under the hood: using strace to watch brk and mmap syscalls, measuring syscall cost, and explaining how the heap, arenas, bins and the mmap threshold let small allocations avoid hitting the kernel, with benchmarks comparing allocators.
14 min · 3,249 words
We can do better than line-buffered output
Chris Wellons argues line buffering is a common bottleneck in terminal programs and proposes deadline-based flushing, where output is flushed after a short time limit instead of on every newline, with C examples.
4 min · 823 words
Pointer Provenance in Rust vs C++
Sofía Belén López Vicens explores pointer provenance, the idea that pointers are more than plain integers, by inspecting LLVM IR and comparing how C++ and Rust approach provenance and the optimisations and undefined behaviour it affects.
9 min · 1,976 words
David Priver shows the simple, correct way to loop backwards over a buffer with an unsigned size_t counter in C, avoiding signed-index conversions and off-by-one bugs he says he keeps seeing, even more so in LLM-written code.
2 min · 444 words
A Unix archaeology post that reads the original Unix sources, starting with the fourth edition from 1973, to show how early Unix and C handled memory allocation, tracing how malloc() was implemented and evolved across early editions.
16 min · 3,754 words
Making SIMD Code Scale to Any Vector Width
Stream HPC's Nemi Verploegh shows how to restructure vec3/vec4-style SIMD code, using a frustum culler as the example, so it scales from SSE to AVX and wider: turn vectors into lanes so eight dot products take three instructions, convert early-outs into masks, precompute splatted values the compiler cannot keep in registers, and write results a block at a time, for roughly 20-25x overall speedup.
19 min · 4,353 words
Billion-query-per-second lookup tables in C++
Daniel Lemire shows how to replace std::unordered_map for small, compile-time-known string sets (HTTP methods, headers, keywords) with a constexpr perfect hash, cutting each lookup to a single comparison and about five cycles, and shares a single-header C++ library and benchmarks built with Francisco Geiman Thiesen of Microsoft.
5 min · 1,221 words
GOTO Considered Totally Sick (for error handling in C)
Returning to C after years of Go and Zig, the author misses defer and errdefer, and after reading John Carmack's emails on inlined code shows how a single goto cleanup label makes C error handling simpler: resource cleanup lives in one place at the end of the function instead of being duplicated at every failure point, the same centralized-exit pattern the Linux kernel coding style recommends.
5 min · 1,204 words
yossarian explains why the POSIX wordexp(3) API, often recommended for tilde expansion in C, enables command substitution by default, and why even the WRDE_NOCMD flag is unreliable on musl and macOS, so it should never be used on untrusted input.
1 min · 258 words
Attention people who think UB is fine
Thomas Habets follows up his post on undefined behaviour in C with a concrete example showing that UB is not 'at worst a segfault': the same line can run whatever is next in memory, write a random value and crash, or do what you naively expect.
3 min · 609 words
Using a lookup-table to correct an approximation
A corsix.org post on compiling enum-to-string functions compactly: instead of a switch or a full offset table, compute a fast but incorrect approximation of each string's offset and fix it with a small table of corrections, a general trick compilers still miss.
4 min · 827 words
Composite objects and C++26 the std::polymorphic type
Marius Bancila explains C++26's std::polymorphic, the companion to std::indirect for owning polymorphic members in composite classes, covering value semantics, copying, and how it simplifies strategy objects, AST nodes, and similar has-a hierarchies.
8 min · 1,888 words
The Problem with C++ Safety (Part 1): Why “It Works” Isn’t Good Enough
Klaus Iglberger, writing on Rainer Grimm's Modernes C++ blog, argues that C++ code that 'works' is not the same as memory-safe code, introducing why informal testing is a weak safety argument and what stronger reasoning looks like.
9 min · 2,085 words
Native Prometheus integration with NGINX
Categorica open-sources nginx-stats-prometheus, an MIT-licensed NGINX module that exposes Prometheus metrics directly from NGINX instead of running the separate NGINX Prometheus Exporter sidecar with its own web server, and explains the design and trade-offs.
5 min · 1,150 words
Faster than earcut: triangulating 3.7M map polygons in 489 ms
Evgen Bodunov of Globus Software explains how the GLMap engine's polygon triangulator, now open-sourced as earstrip (one C++ header plus a WebAssembly npm build), beats earcut: 14% faster in C++ and 1.4–2.1x faster in the browser, covering convex shortcuts, triangle strips and branch-free counting.
17 min · 3,810 words
Abner Coimbre describes how he writes modern C in late 2026 after C23: naming, headers, types, error handling, and the conventions he kept from older 'How I Write C' guidance while adopting new language features.
4 min · 939 words