To Save C, We Must Save ABI

The C programming language's ABI (Application Binary Interface) is a hidden contract that determines how functions and structs are represented in binary. Breaking it can cause silent, catastrophic failures. This article argues that while ABI stability is often seen as a burden, it is crucial for C's survival. It demonstrates how changing a function's parameter type from long long to __int128_t alters the assembly code, requiring different registers and conventions, and shows how a mismatch between declaration and definition can lead to undefined behavior. The author contends that preserving ABI is essential for C's ecosystem, even as it limits innovation.
This is not a source code-level contract: it is one forged by the compiler, on your behalf, with other compilers and other machines.
- davemp
> legacy choices when we quite literally were just not smart enough to be making permanent decisions like this
Unnecessary hubris. I assure you the original ABI authors were plenty smart and just faced a different set of problems.
> Our forebears are either not interested in a world without the mounting, crushing debt or just prefer not to tackle that mess right now
The article mentions the organizational/social part of this problem, but then goes on to drop this turd.
I can also assure you that our forebears were neither malicious or lazy; but faced the same problem this proposal does.
I don’t like seeing such disrespect for the folks who laid out the groundwork for us.
- usrnm
The famous C dilemma: we want to be as close to the machine as possible, but don't want to change anything when the machine changes
- aw1621107
Previous submissions with comments:
- 2023-06-10, 64 points, 16 comments: (https://news.ycombinator.com/item?id=36249253)
- 2022-03-13, 175 points, 129 comments: (https://news.ycombinator.com/item?id=30660528)
- codeflo
Thousands of words that boil down to "intmax_t isn't ABI-stable". Who knew? (Everybody.)
- flohofwoe
Should have a (2022) in the title, not that anything has changed (AFAIK), but the sky didn't fall either ;)
In the end, OS/CPU combinations define ABIs, compiler toolchains (no matter what language) can't do much more then follow (if they want to be able to talk to the operating system at least). E.g. if one day operating systems implement stable Rust-friendly ABIs, then C compilers will have to adapt to those conventions instead.
- Elder_Baker
Who cares if C dies. If dies then dies do not deserve to more. It means progress.
- Decabytes
One of the most frustrating things in my opinion about new systems languages, is that they refuse to have a stable ability to, so everything has to pretend to be C at the boundaries.
- raytracer1
I used to an embedded software engineer, but I did not know this abi thing.