This article began from a list of reasons I was making which purportedly justify my years-long (and so far fruitless!) pursuit of writing my own systems programming language compiler. More concretely, I was making a list of gripes I have with C. I sorted them into two groups: changes that would improve the safety of the language, and changes that would help maintain the sanity of users and implementers. Now, sure, using a language where#include <stdint.h> #include <stdio.h> int main() { uint64_t foo = 5327584392; uint16_t bar = foo; // implicit narrowing cast! printf("%u\n", bar); } compiles without warnings by default (given that “default” means clang -Wall and doesn’t include digging through the big list of diagnostics to find which ones you think are reasonable and would really quite like to add to your build system) is not particularly conducive to sanity. You might say that safety is part of sanity, and I’d agree with that. However, for the purposes of my list, anything to do with program correctness goes in the first bucket, anything related to scraping off barnacles goes in the second bucket, aaaand I didn’t include anything else.In this article I’ll be focusing on two features of C that made my list – assignment expressions and pre/post-increment/decrement expressions – and why I think they’re problematic.Some philosophizingFirst, we need to understand the dichotomy between statements and expressions. As any functional programmer can tell you, expressions are trivially nestable, which is what makes them so flexible and expressive. Although statements are capable of nesting in some circumstances, they don’t have the propensity to do so to nearly the same degree as expressions. How many layers of ifs and whiles do you usually see? Not a lot. Something like a.factor * f(b.foo, b.bar / 2) + 1, on the other hand, is commonplace, and that has at its deepest point four levels of nesting!At its core, this difference comes down to something more fundamental: in a pur...
First seen: 2026-03-23 17:09
Last seen: 2026-03-23 22:12