logoalt Hacker News

nextaccountictoday at 4:44 AM6 repliesview on HN

> Principles

> Be extremely portable

> sp.h is written in C99, and it compiles against any compiler and libc imaginable. It works on Linux, on Windows, on macOS. It works under a WASM host. It works in the browser. It works with MSVC, and MinGW, it works with or without libc, or with weird ones like Cosmopolitan. It works with the big compilers and it works with TCC.

> And, best of all, it does all all of that because it’s small, not because it’s big.

vs

> Non-goals

> Obscure architectures and OSes

> I write code for x86_64 and aarch64. WASM is becoming more important, but is still secondary to native targets. I don’t care to bloat the library to support a tiny fraction of use cases.

> That being said, if you’re interested in using the library on an unsupported platform, I’m more than happy to help, and if we can make the patch reasonable, to merge it.

Those are contradictory. Either the code is extremely portable, or it can't support "obscure" platforms, but not both.


Replies

ktpsnstoday at 4:50 AM

Exactly. This shows that "extremely portable" is actually marketing for "It supports a number of platforms. In my opinion, this number is big".

show 2 replies
kazinatortoday at 6:22 AM

You can be portable, without supporting obscure platforms.

Supporting obscure platforms is what makes portability "extreme", though.

show 1 reply
dboontoday at 6:42 AM

There are very few C libraries which compile, stock, against the matrix of toolchains, ABIs, and operating systems that this library does. For the subset of machines which run, I don't know, 99.9% of all instructions (i.e. x86_64 + aarch64, Linux + Darwin + Windows), the library just works. This is a definition of portability. Why would portability be a binary of supporting every possible system or being hard tied to a single one?

show 1 reply
riedeltoday at 6:00 AM

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.

show 3 replies
forrestthewoodstoday at 6:24 AM

That’s a lot of text to say “well ackshually”.