I don’t use LLMs to code, and I find it somewhat bizarre that everyone else does. The reason is simple: I want to have control over my tools and the projects I make. I want to be able to work even if I’m using a $109 Chromebook flashed with Mr Chromebox UEFI firmware that runs Void Linux while living off-grid in a tent. (Hypothetically…) It’s the same reason I don’t use proprietary game engines or…
In this article I discuss how memory arenas interact with strict type aliasing in C, and how to use the clang type sanitizer to check compliance. Table of contents Requirements Strict aliasing Memory arenas Arenas and aliasing Type sanitizer Requirements We will need GNU libc based Linux system with the clang C compiler. If you are running a non-GNU system, e.g. one using musl libc, then you can…
The chroot utility runs a process with the given directory set as the root / directory of its filesystem. There are many use cases for such a tool, e.g. to mess around in a Linux system without booting it, to run glibc software on a musl -based host, or to test examples in a fresh sandbox. This article will not dwell on security concerns: we’ll assume the software we run is not adversiarial. If…
I like to write C that is portable to build as well as run. To that end, all of my projects should build with any C compiler cc that supports the C99, C11 or C23 standard. They have no other development dependencies: no need for pkgconfig , or the presence of headers or libraries beyond those that come included with a minimal version of the target operating system (e.g. libc on Unix). I test all…
I have been a Linux user space programmer for well over ten years, but only recently dipped my toe into kernel development. In this article I’ll go over the Linux kernel build system, bare-bones initramfs system emulation, debugging code that runs in kernel space, kernel modules, and testing kernel code within a full Linux distribution. Table of contents Requirements Building the Linux kernel…
This article covers my experience writing aven-cfmt , a zero-dependency C parser and renderer. Table of contents Motivation C is hard Coding style Tokenization Parsing Preprocessor Rendering Fuzzing Motivation When it comes to C source code formatting, there are three big tools available: clang-format , astyle , and indent . Unfortunately for me, all three are designed with a few standard project…
Anyway, do you guys have an Android charger? I told you, we don’t support that. Recently, I set out find a simple way to package my C and OpenGL desktop apps into .apk files that would run on my Pixel 7a phone. I am a dependency minimalist, so I wanted to avoid the Android Studio IDE and its associated build systems if at all possible. The wonderful rawdraw Android project is a C app framework…
What is the easiest way to draw pixels to the screen on a modern Linux system? I have had this question bouncing around in the back of my mind for a long time. A while ago I made a tiny application that displayed images using the /dev/fb0 device. Unfortunately, fbdev is a legacy subsystem that won’t always be present. Fortunately, the modern Direct Rendering Manager subsystem provides…