Lib0xc: A set of C standard library-adjacent APIs for safer systems programming
lib0xc is a collection of C library-adjacent APIs designed to make systems programming in C significantly safer by addressing common vulnerabilities and poor API designs. It emphasizes compile-time bounds checking, static analysis, and drop-in replacements for standard library functions to encourage safer coding patterns. The library supports clang's bounds safety extensions and promotes a 'pit of success' design where correct usage is easier than misuse.
- ▪lib0xc uses macros and compile-time checks to enable safer C programming with static bounds and type safety.
- ▪Its APIs are designed as familiar, drop-in replacements for standard C library functions to ease adoption.
- ▪The library supports -fbounds-safety, embraces -Wall -Wextra -Werror practices, and avoids dynamic allocations where possible.
Opening excerpt (first ~120 words) tap to expand
lib0xc A set of C standard library-adjacent APIs for safer systems programming. While C cannot be made completely type- and bounds-safe at the language level, its prevailing uses can be made much safer than they are today. Goals "Make C safer" is a nebulous and amorphous goal, and it is more apt as a programming language design statement than a modest set of utilities. With that in mind, lib0xc has the following concrete goals. -Wall -Wextra -Werror -Weverywhere That last one isn't real, but still, lib0xc's goal is to make it possible for projects to turn on as many warnings as possible and to fail to build if code introduces new warnings. Often, certain high-value warnings are disabled because a project wants to, e.g.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at GitHub.