Egregoros

Signal feed

Timeline

Post

Remote status

Context

1
@WandererUber everything is manual in C. Headers traditionally only include function prototypes and data type definitions. You can define full functions in a header only if you declare a function with the keywords "static inline" and that is actually a nonstandard extension that is just widely supported. If you declare a function in a header without it you will have link errors if you include it from more than one C file.

Replies

10
@WandererUber @icst I guess it depends what you mean by a "good" reason - it was a good reason at the time of C's creation, because those were the problems we were setting out to solve at the time. That it doesn't always solve modern problems in an elegant way shouldn't be surprising, as no language is future-proofed in perfect elegance and is always solving some set of problems elegantly at the expense of others being less so

the one exception of course is MY language that I have yet to write which will be elegant in all cases :frothvibrate:
>That it doesn't always solve modern problems in an elegant way shouldn't be surprising
That's not what was the "surprising" aspect of my post. The fact nobody was able to fix this once computers had more than 2 megabytes of RAM is what's "surprising"

There's no way they could have known what sorts of hellspawn abominations would come out of their "conveniences" from back then and now that people know, they don't want to do it the C way anymore.
Other languages of course have their own versions of dependency hell, but C's is particularly antiquated. Headers are annoying and everyone agrees basically.
@WandererUber @icst oh I see I thought you were bothered by C itself not doing that. Yeah I think a big part of it is a psychological thing on the part of language designers - they want to do something "BIG" not just a few changes. I joke about JBlow a lot but I do think the way Jai started out was exactly what you want. These days it still has those improvements but it also has a lot of metaprogramming conveniences that are the "BIG" thing. I think Zig and Odin might also scratch a similar itch but I haven't looked much into them
>Jai Zig Odin
I knew about those and plan to learn them, but since they deviate so much I felt like getting back into C first. They all removed headers and preproc macros btw, because it's anachronistic.

Blow is REALLY cooking with Jai, I'm pretty sure.

>oh I see I thought you were bothered by C itself not doing that
Well I mean it is what it is. But obviously everyone who knows anything is bothered by it at this point.
It was a bit of a jokey OP, but my idea was "why isn't anyone simply breaking the standard?", if you know what I mean. If gcc added any of this there would be a freakout, but if someone wrote some tooling that acted like a shim and just brute-forced it, i.e. rewrote all header imports to .c imports and stuff so that "old-style" C would compile but you could use these new conveniences in YOUR code, I think it would take off.
Especially with anyone new googling stuff about C.
"If I use this, I never have to deal with this crap again and can focus on putting buffer overflow bugs into my string functions? Great."