Earlier quoted context omitted.
That's fine. Just don't call it "ultra portable" while treating it as a non-goal.
He's already hit the hard targets. I think ultra portable is an accurate description. Portable means able to be ported, not "has been ported".
sp.h: Fixing C by giving it a high quality, ultra portable standard library
211–220 of 222 posts
Re: sp.h: Fixing C by giving it a high quality, ultra portable standard library
#212They're just inventing another language here. That's fine if you want to do that. Just do THAT. C is horribly and unfixably broken. We've known that for many decades. Just let it die already! Let's move on.
Re: sp.h: Fixing C by giving it a high quality, ultra portable standard library
#213Earlier quoted context omitted.
Making every C call a system call is not a good idea at all - think about malloc() etc - the OS shouldn’t care about individual allocations and only worry about providing brk() etc. otherwise, performance will die if you’re doing a thousand system calls per second!
No modern libc uses (or should use) brk() as the heap. Allocate virtual memory using mmap, VirtualAlloc, etc., and manage your set of heaps.
Re: sp.h: Fixing C by giving it a high quality, ultra portable standard library
#214Earlier quoted context omitted.
Portable has two meanings: a construct is portable if we can rely on it to work everywhere. A portable codebase is one that supports moving to a new platform, with some nonzero effort which is not large compared to rewriting the code. It is able to be ported. E.g, "Johnson's Portable C Compiler (PCC)". If only the Foo kernel must be rewritten in order to port Foo, but that kernel is 75% of Foo, then I would say Foo i…
> “Portable”, in the context of how it was used, generally refers to software using platform agnostic idioms. “in the context of how it was used,” This isn’t some meta conversation about how to write portable software. This is a conversation specific to what the author had written about their project.
There is a usage of "portable" which has to do with percentage of installations it runs in or can be easily made to run in, regardless of how much has to be changed to get it working anywhere else.
Re: sp.h: Fixing C by giving it a high quality, ultra portable standard library
#215> I’ve been working on fixing C by giving it a high quality, ultra portable standard library If the only problem with C was that the stdlib is terrible that would be a very different situation. There are much more fundamental problems with the language. Problems that are entirely understandable in K&R C but aren't acceptable half a century later. A "high quality" standard library can't fix these problems. In some cas…
These are all just your personal preferences. Just use another language instead which better matches your taste, nobody forces you to use C and there are plenty of more opinionated alternatives. FWIW, the standard library being stuck in the K&R era is an actual problem since it doesn't make use of more modern language features and some functions are downright footgun magnets, but nobody quite agrees what a modern std…
That isn't really an option if you are working on an existing project written in c.
Re: sp.h: Fixing C by giving it a high quality, ultra portable standard library
#216Earlier quoted context omitted.
I could not even find a mention what platform it supports. There is a Linux example on the bottom. Have never seem a libc implementation that does not even mention for which platforms it is meant.
It...is not a libc implementation. That's an impressive level of misunderstanding!
Yes, I know the author's writeup then goes on to say that it is not a libc with a pile of questionable justfication. This is a custom runtime, in a single header no less, which is admittedly impressive, especially considering it provides runtime and thread safety primitives. This does not rise to the level of claiming the idea of a 'standard libarary' though, IMO. In that, I think the author misses the point.
Re: sp.h: Fixing C by giving it a high quality, ultra portable standard library
#217Re: sp.h: Fixing C by giving it a high quality, ultra portable standard library
#218Earlier quoted context omitted.
The author can do whatever they want. But if all you want to support is x86-64, ARM64 and maybe some version of RISC-V, don't crow about how 'extremely' portable you are. At best, you don't know.
portable is a different word from ported.
But yeah...for some people "meh, close enough" is good enough.
Re: sp.h: Fixing C by giving it a high quality, ultra portable standard library
#219Earlier quoted context omitted.
Yes, unfortunately the threading primitives require libc. Ditto subprocesses. It's on my list. But regarding: "Oops... apparently this is vibecoded. Welp, I just wasted ten minutes of my life reviewing slop that I'm not going to get back." Do not talk to people like this. I don't care if you don't like the library, or if you found a flaw in it. I am a regular person who wrote this code for no other reason than I thou…
> It's unbelievably rude to call it vibecoded slop Could you clarify how much of this code and blog post was written by an LLM?
Re: sp.h: Fixing C by giving it a high quality, ultra portable standard library
#220Earlier quoted context omitted.
> “Portable”, in the context of how it was used, generally refers to software using platform agnostic idioms. “in the context of how it was used,” This isn’t some meta conversation about how to write portable software. This is a conversation specific to what the author had written about their project.
In context, they probably mean portable by installed base of targets. In a world in which nothing but ARM cores exist, a machine language ARM program is portable, and even "extremely" so. There is a usage of "portable" which has to do with percentage of installations it runs in or can be easily made to run in, regardless of how much has to be changed to get it working anywhere else.
As I said before:
> “Portable”, in the context of how it was used, generally refers to software using platform agnostic idioms.
Words have meanings. If the code is tied to an architecture then it isnt portable. And as you said, there’s nothing wrong with that. But arguing some other definition of a word people are already using is just stupid.