logoalt Hacker News

C isn't a programming language anymore (2022)

58 pointsby stickynotememotoday at 12:15 AM57 commentsview on HN

Comments

Animatstoday at 5:53 AM

The trouble with C as an API format is that there's no size info. That's asking for buffer overflows.

There's an argument for full type info at an API, but that gets complicated across languages. Things that do that degenerate into CORBA. Size info, though, is meaningful at the machine level, and ought to be there.

Apple originally had Pascal APIs for the Mac, which did carry along size info. But they caved and went with C APIs.

nacozarinatoday at 1:04 AM

None of the alternatives have stability. What was exemplary & idiomatic rust pre-pandemic would be churlish & rejected now and the toolchain use would be different anyway.

Carpenters, plumbers, masons & electricians work on houses 3-300 yrs old, navigate the range of legacy styles & tech they encounter, and predictably get good outcomes.

Only C has, yet, given use that level of serviceability. C99, baby, why pay more?

When there’s an alternative that can compete with that sort of real-world durability, C will get displaced.

show 5 replies
pizlonatortoday at 1:41 AM

It’s weird how whiny this post is. Like there’s zero intellectual curiosity about why C got this way, and why C gets to be the foundation for how systems software is written.

I could write a whole essay about why, but now isn’t the time. I’m just going to enjoy the fact that TFA and the author don’t get it.

show 4 replies
hacker_homietoday at 5:42 AM

It's not that it was made this way to annoy you, it was all we had.

The whole world shouldn't "need to be fixed" because you won't spend the time to learn something.

Rust doesn't even have a stable Internal ABI that's why you have to re-compile everything all the time.

groundzeros2015today at 2:33 AM

What languages does this author like which has a written spec?

show 1 reply
agentultratoday at 2:22 AM

I mean… an ABI is more like an agreement. It isn’t a specification. It’d be nice if everything was neatly specified and sound. But as the author notes near the end… there’s a lot of platforms and they all have their own quirks.

There has to be an ABI that has to be agreed upon by everyone. Otherwise there wouldn’t be any interoperability. And if we didn’t have the SystemV ABI — what would we use instead? Prepare for a long debate as every language author, operating system designer, and platform under the sun argues for their respective demands and proposals. And as sure as the sun rises in the East someone, somewhere, would write an article such as this one decrying that blessed ABI.

SystemV shouldn’t be the be all and end all, IMO. But progress should be incremental. Because a lingua franca loses its primary feature and utility when we all return to our own fiefdoms and stop talking to one another in the common tongue.

It’s a pain in the metaphorical butt. But it’s better, IMO, than the alternatives. It’s kind of neat that SystemV works so well let alone at all.

mjg59today at 2:11 AM

I really don't understand why people keep misunderstanding this post so badly. It's not a complaint about C as a programming language. It's a complaint that, due to so much infrastructure being implemented in C, anyone who wants to interact with that infrastructure is forced to deal with some of the constraints of C. C has moved beyond merely being a programming language and become the most common interface for in-process interoperability between languages[1], and that means everyone working at that level needs to care about C even if they have no intention of writing C.

It's understandable how we got here, but it's an entirely legitimate question - could things be better if we had an explicitly designed interoperability interface? Given my experiences with cgo, I'd be pretty solidly on the "Fuck yes" side of things.

(Of course, any such interface would probably end up being designed by committee and end up embodying chunks of ALGOL ABI or something instead, so this may not be the worst possible world but that doesn't mean we have to like it)

[1] I absolutely buy the argument that HTTP probably wins out for out of process

show 3 replies
themafiatoday at 4:36 AM

> C was elevated to a role of prestige and power

We didn't do it to annoy you or to foist bad APIs on you. We did it because it was the best language for writing machine code at the time. By miles. Not understanding why this is true will lead you to make all the same mistakes the languages "bested" by C made.

TZubiritoday at 1:49 AM

>Phantomderp and I

>Furry avatar

>"About Me I am Aria Desires, Gankra, and a cat."

I seem to recall reading this before, I must have not noticed this furry stuff because I would have ignored it.

My take was that this is a rustacean who was having trouble porting something to C and then went in a deep rabbit hole of C traiditional software, and instead of recognizing that perhaps they are in way over their head, they concluded that the issue was in the C, that it's all wrong and therefore their mission of porting stuff to Rust is even more virtuous.

show 3 replies
orionblastartoday at 12:24 AM

I always thought that C was a stepping stone to learn other languages. Like Pascal, it was educational to learn. My Comp Sci courses in 1986-1990 used Turbo Pascal and Turbo C.

show 2 replies
ranger_dangertoday at 1:52 AM

I try not to put much stock in black-and-white opinions because I think the answer is rarely that simple.

bigbuppotoday at 3:02 AM

TL;DR author loves rust and writing a subset of a c compiler is hard

show 1 reply