logoalt Hacker News

nly • today at 9:06 AM • 4 replies • view on HN

C has most of the same problems raised in the article. You'll notice there's no "C SDK" on all those third party SDK lists either. There's no universal package manager for C. No standard library worth a damn.

My personal view is APIs and behaviours should be standardized, not libraries. In that respect C++s efforts to figure out universal async I/O is a noble one unmatched by other languages. And it's a hard problem.

That's not to say it hasn't gone off the rails. The Sender-Receiver model has never 'clicked' for me. I think the ideas is alien and overly abstract and I've never seen anything elegant fall out of it on a single page. Coroutines on the other hand make sense. The C++ language implementation of them is elegant and versatile.

std::execution is a verbose mess.

At my employer pretty much all of our code is C++ and threads aren't used anywhere. As a result, I/O tends to go through our own APIs written to use an Linux ioring backend behind C++ coroutines, which yield to our own main event loop.


Replies

silvestrov • today at 12:23 PM

I think C and C++ always have suffered from wanting to support all kinds of weird architectures like 9 bit bytes and 80286 style segmented memory. So many people see this as a virtue rather than restricting the usefulness of C.

So char always means "byte" and never a real character. I don't think many C programs will work well if char is a 32 bit type so it supports full unicode.

int8_t came way too late and has a way too long name. It should be i8 or int8. There is a problem when C is more verbose than Java. Also: why did it take so long to get a boolean type and fix the "bools are ints" design mistake.

Lack of standard libraries and module system is just another layer of not wanting to standardize things.

whizzter • today at 9:40 AM

Kinda disagree here about the "elegantness", superficially it's an elegant abstraction to unify generator-like coroutines and "tasks".

In practice it's bad, a generator (co_yield) is often an encapsulated object that will have a non-deterministic lifetime, thus it cannot be put into a fifo.

"Tasks" however (co_await / co_return) often live on a stack-fifo that could've been mixed with partial bump-allocators to allow pointer-stability for the stack-frame (there is kind of the machinery via the new overloading for the promise), but due to varying lifetimes it easily becomes a mess (Looked at some other task library that seemingly had low allocations like this but it feels like the entire machinery can easily break with "careless" usage).

And I think that's a part of why std::execution feels like a mess, it tries to make coroutines in task settings more "usable" for those writing things around tasks, but it doesn't really decide on a coherent direction for tasks (since the language primitive was left too abstract/messy).

➕ show 1 reply
mschuster91 • today at 12:36 PM

> There's no universal package manager for C. No standard library worth a damn.

The package manager for C is whatever your distribution uses plus pkg-config. The standard library is the C standard stuff plus POSIX.

ghosty141 • today at 12:06 PM

> C has most of the same problems raised in the article

Correct but I'd argue almost nobody builds desktop applications in C anymore and the places where C is the most common (embedded) they built full on frameworks including package managers around them.

➕ show 1 reply