Topic

C

C programming discussions covering systems programming, memory management, and embedded development. Our digest aggregates undefined behavior, compiler optimizations, and embedded systems from developer communities.

What this topic tracks

  • Language releases and proposals
  • Libraries, tooling, and ecosystem updates
  • Performance, idioms, and production lessons

C · 248 stories

Recent stories

Each story's summary, with the places it was discussed.

Summaries are written by AI from the linked sources. Open the source for full context.

20 stories

Idiomatic Lisp and the nbody benchmark

stylewarning.com · 2 Apr

C · Performance · Software Architecture

Common Lisp can achieve C-level performance by utilizing its metaprogramming capabilities to build domain-specific languages (DSLs).

By implementing a custom kernel-style DSL, the author demonstrates that Lisp code can remain readable, idiomatic, and performance-competitive with C in computational tasks like the nbody benchmark, challenging the notion that Lisp must sacrifice efficiency for expressiveness.

Obvious Things C Should Do

digitalmars.com · 8 Jan

C · Programming Languages · Software Architecture

In this article, Walter Bright, creator of Dlang, examines critical shortcomings in Standard C and proposes essential modern improvements implemented in ImportC, a C compiler built for the D language.

He highlights four key areas where C remains outdated: the inability to perform Compile Time Function Evaluation (CTFE), the lack of integrated unit testing, the rigid requirement for forward declarations, and the cumbersome dependence on header files. Bright argues that a modern C compiler should allow executing functions at compile time for constant expressions and static assertions, enabling seamless unit testing without separate build targets. Furthermore, he advocates for modern symbol resolution that eliminates the 'stone age' restriction of lexical ordering and replaces manual header file management with a direct import system. These changes aim to reduce 'busywork' and bring C development into the modern era.

C Programming Language Quiz

stefansf.de · 22 May

C · Programming Languages · Computer Science

This content provides a comprehensive quiz exploring various technical quirks, undefined behaviors, and standard specifications of the C programming language.

It covers topics like pointer aliasing, integer constants, function declarations, memory storage durations, and evaluation orders, offering educational insights into how C implementation works across different standards and platforms.

BorrowSanitizer

borrowsanitizer.com · 4 Aug

C · C++ · Rust

BorrowSanitizer is an LLVM-based dynamic analysis tool designed to detect Rust-specific aliasing bugs in multi-language applications.

Unlike Miri, it aims to support C and C++ interoperation and offers high-performance execution suitable for fuzzing and production use, addressing security vulnerabilities arising from incorrect usage of unsafe Rust code.

Swift at Apple: Migrating the TrueType Hinting Interpreter

swift.org · 12 Jun

C · Performance · Swift

Apple rewrote its TrueType hinting interpreter from C to Swift, prioritizing memory safety for handling untrusted font data.

The project maintained pixel-identical rendering while achieving a 13% performance improvement over the original C implementation. The team utilized noncopyable types, projection structures, and careful memory management to ensure the new interpreter remains both efficient and secure.

My C23 Conventions

abner.page · 15 Oct

C · Programming Languages

C23 has led the author to adopt three safer C conventions: use [[maybe_unused]] (often with auto _) when intentionally discarding [[nodiscard]] results; use empty initialization ({ }) to fully zero structs and unions, rather than relying on {0} or designated initializers; and specify enum underlying types explicitly, such as enum options : int, to prevent implementation-adjusted widths from hiding invalid bit flags.

These practices reduce compiler warnings, initialization bugs, and enum surprises in maintained projects.

Pidgin 3.0 Alpha 1 2.95.0 has been released

discourse.imfreedom.org · 31 Mar

C · Software Architecture · Open Source

Pidgin has released the first alpha of 3.0 (version 2.95.0), focusing on stable protocol APIs and a new AccountSettings architecture.

Key features include an overhauled account editor, a new Zulip protocol plugin, and the removal of libxml2 dependencies in favor of SQLite. This release is for developers only and is not yet production-ready.

Supercazzola - Generate spam for web scrapers

dacav.org · 14 Feb

Cybersecurity · C · Open Source

Supercazzola is a scraper tar pit designed to poison web crawlers and greedy AI bots that ignore robots.txt.

Written in C using libevent, it dynamically generates an infinite graph of random HTML pages via Markov chains, effectively trapping and wasting the resources of malicious automated scrapers.

Ending 15 years of subprocess polling

gmpy.dev · 28 Jan

C · Linux · Python

This content discusses a significant optimization in process management for POSIX systems, specifically targeting Python's subprocess module and the psutil library.

For years, these tools relied on a resource-intensive busy-looping approach to monitor process termination when a timeout was specified. By implementing event-driven waiting using system calls like pidfd_open with poll on Linux and kqueue on BSD and macOS, the author replaced constant CPU polling with kernel-level notifications. This change drastically reduces CPU wake-ups, improves battery life, and lowers latency. The improvement has been merged into psutil and upstreamed to the CPython standard library, representing a major efficiency gain for Python developers on Unix-like platforms.

30 years of Internet transfers with curl

daniel.haxx.se · 10 Nov

CLI · C · History

curl’s 30-year history began with Rafael Sagula’s 1996 httpget, a roughly 100-line C program for HTTP downloads.

Its maintainer added hostname resolution, Gopher and FTP support, uploads, and renamed it curl in 1998; libcurl followed in 2000 and was adopted by PHP. Developed iteratively under a liberal Open Source license, curl now supports more than two dozen protocols, runs in an estimated 30 billion installations, and remains an independent, portable infrastructure component without a rewrite.

Babashka 1.13.220 gets FFI

blog.michielborkent.nl · 31 Aug

C · Low-Level Programming · Programming Languages

Babashka 1.13.220 introduces experimental babashka.ffi for calling C libraries from Babashka and JVM Clojure.

It adds explicit memory management, safer arena-based allocation, SQLite integration, and new demos. The release changes Linux binaries to mostly-static builds, while task improvements support dependency composition, inherited CLI options, direct exec arguments, and lazily loaded command trees.

Perspec 1.0: A Haskell desktop app for perspective correction of document photos

adriansieber.com · 24 Aug

Algorithms · Computer Vision · C

Perspec 1.0 is a cross-platform desktop and CLI app for correcting image perspective, especially in document and receipt photos.

Its new computer vision pipeline segments document boundaries and uses Förstner corner detection rather than assuming straight edges, while shadow-removing preprocessing and Otsu's Method produce compact, clean black-and-white exports. Windows, macOS, Linux, batch processing, manual correction, and Save BW Smooth complete the release.

C Strings: A 50-Year Mistake

longtran2904.substack.com · 11 Jul

C · Programming Languages · Software Architecture

The author argues that null-terminated C strings are an outdated, error-prone design.

By using structure-based strings that explicitly include a pointer and length, developers can improve performance, avoid ambiguity, enable efficient slicing, and handle binary data safely. Adopting length-based strings significantly reduces memory-related bugs and simplifies string manipulation compared to traditional C approaches.

Why Can't We Just #include "functions.c" in "main.c"? 🤔

dev.to · 26 Nov

C · Education

C programs usually expose function declarations in a header such as functions.h, include that header in main.c, and compile main.c and functions.c together. #include literally copies text before compilation, while each .c file is compiled separately into an object file and later combined by the linker.

Including functions.c would merge files, reduce parallel and incremental compilation benefits, and can create multiple-definition errors when included in more than one source file; #pragma once does not prevent those linker duplicates.

Filian, Fil-C binaries on Debian

cr.yp.to · 27 Oct

CLI · C · Linux · Programming Languages

Fil-C, a memory-safe C/C++ compiler, is compatible with many libraries and applications and can be integrated into Debian through Filian, which downloads, builds, and installs Fil-C and selected Debian source packages.

Fil-C successfully built 60 of 61 tested targets, while typical cryptographic benchmarks used 1–4× as many cycles as clang. Filian introduces an amd64filc0 ABI, separate libraries, and Debian package workflows; most tested software works, though some components need patches or replacements.

The design of littlefs

github.com · 18 Jun

C · Low-Level Programming · Software Architecture

littlefs is a file system designed for 32-bit microcontrollers, prioritizing power-loss resilience, wear leveling for SPI NOR flash, and bounded RAM/ROM usage.

It combines logging and Copy-on-Write techniques to achieve efficiency and atomicity, using CTZ skip-lists for data storage and metadata pairs for updates, ensuring reliability on memory-constrained devices.

String Type In C

dev.to · 24 Nov

C · Low-Level Programming

The article builds a basic string type in C with a heap-allocated struct containing a char* buffer, current length, and capacity. string_new() rejects NULL, calculates storage for the text and terminator, allocates memory with malloc, copies the text, and returns the struct. string_free() releases memory and resets fields.

The example prints “Welcome King Nyaomaru!” and notes that the design can be extended with append, prepend, and resize operations.

Memory management in 40 major C projects, a survey

theconsensus.dev · 15 Nov

C · Low-Level Programming

An analysis of 40 major C projects finds that manual malloc/free remains dominant, but higher-level strategies are widespread.

Eight projects use only manual allocation; 16 are primarily manual, including SQLite (100%), curl (94%), Redis (79%), Linux (71% manual, 29% regions), and QEMU (86% manual). Seven primarily use regions, five garbage collection, and three reference counting; CPython leads the latter at 85%. Linux and QEMU also use scope cleanup extensions.

Using a lookup-table to correct an approximation

corsix.org · 21 Oct

C · Low-Level Programming · Performance

Enum-to-string functions implemented as switches can be optimized into lookup tables, but pointer tables consume space and relocations.

Concatenating strings and storing 16-bit offsets reduces size; an even smaller representation approximates each offset as x * 17 and stores only signed corrections in the range [-9, +10]. The technique computes an exact result through a fast approximation plus corrections, highlighting a useful optimization that compilers may miss.

an ambiguity in c89 which will never be fixed

sebsite.pw · 10 Aug

C · Programming Languages · Computer Science

The C89 standard contains ambiguous language regarding implicit function declarations, leading to conflicting implementations in GCC and Clang.

The core issue involves whether these declarations occur within function prototype scope or block/file scope. Because this feature was removed in C99, the inconsistency remains unresolved, serving as a reminder to avoid legacy C89 standards.

Where it came fromLobstersDev.toCreate a Snapbyte.dev digest and choose C as one of your topics.Build your digest