News for hackers. Stuff that matters.
Re:Sshole by uecker on Thursday November 05, 2026 @11:12AM (#50380936)
While I agree that this should come out of the box, the "rest of the fucking owl" is a tiny macro or function, so not exactly something difficult to do complex as "drawing an owl" would imply.
Re:Sshole by creata on Thursday November 05, 2026 @11:15AM (#50380968)
But then you're writing C in a way that almost no one else writes C. And you still don't have Rust's match ergonomics.
Re:Sshole by muvlon on Thursday November 05, 2026 @11:18AM (#50380986)
There are different amounts of effort you can pour in to this depending on your requirements, and we can argue about those, but to me the evidence is clear: It's too much of a hassle for library authors to actually go and do it. Everyone just uses sentinel values instead.
Re:Sshole by dvdkon on Thursday November 05, 2026 @01:15PM (#50382361)
Sure, when I last wrote a sizeable chunk of C, I wrote those macros and with a bit of help from new-ish compiler warnings, I got a reasonable error handling system in C. But whenever I interacted with anyone else's code, they apparently didn't get the memo that this is possible and desirable.

A language should encourage writing robust/secure code, not just make it possible.

Re:Sshole by uecker on Thursday November 05, 2026 @02:20PM (#50383210)
While I see the point, I am not entirely sure I agree. I kind of like that C is not an opinionated language which tells you exactly how to write things. This comes at the cost that many people will do things in a bad way, and this is difficult to fix, but still probably easier than getting them to move to a different language.

In any case, I do not think the issue here is caused by not having a pre-defined result type. Checking for null would have been fine. The issue was that to accommodate old and broken code a compromise was made. But as long such compromises are done even where fixing such old code would be quite easy, it is clear that changing to another language is completely unrealistic. So what are we even talking about? The real issue is that nobody wants to spend money or effort maintaining the old code. No language can fix this.