logoalt Hacker News

To Save C, We Must Save ABI

65 pointsby gurjeetlast Saturday at 7:36 AM38 commentsview on HN

Comments

flohofwoetoday at 11:24 AM

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 the ABI, compiler toolchains (no matter what language) can't do much more than implement those system ABIs (if they want to be able to talk to the operating system at least). E.g. if one day operating systems implement a Rust-friendly ABI, then C compilers will have to adapt to those rules instead.

usrnmtoday at 8:27 AM

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

show 3 replies
creshaltoday at 11:18 AM

Is C even worth saving at this point? Even standards committee members can't consistently write C code that doesn't overflow and segfault.

show 1 reply
aw1621107today at 9:03 AM

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)

clbrmbrtoday at 11:07 AM

I was battling GCC… until the new guy (a smart business major) pointed out I could just compile from Lua to ASM directly. Claude was happy to write a compiler over night. :facepalm:

show 1 reply
add2today at 10:10 AM

COM-like C ABI saves C++

show 1 reply
jdw64today at 8:39 AM

But the industry ultimately runs on compatibility, so I get why they do it. But if compatibility breaks, wouldn't hardware vendors die out? If you look at PLC and other hardware manufacturers, they're not even using modern coding. They're still running on old code. They say it's 'safe and certified code,' but in reality, it's just legacy code.

Because in hardware, programmers, aside from researchers, are often paid much less and work in worse conditions compared to their software counterparts. At a software company, code is the product itself. But in manufacturing, software is treated as a cost attached to machines worth billions of dollars. While equipment and sensors keep getting updated and more expensive, the people connecting everything are seen as a cost cutting target. So hardware programmers generally have good job security, but their salaries aren't high. In that situation, asking them to learn something new instead of sticking with the old ways usually gets resistance, because they're not being properly compensated for that learning

show 1 reply
xyzsparetimexyztoday at 8:54 AM

Yeah, well, that didn't happen

codeflotoday at 8:59 AM

Thousands of words that boil down to "intmax_t isn't ABI-stable". Who knew? (Everybody.)

show 2 replies