HNHacker News
TopNewBestAskShowJobs

504118318

17 karma · joined May 23, 2026

submissionscomments
504118318··on sp.h: Fixing C by giving it a high quality, ultra portable standard library
You're absolutely right. I should have expressed my late-night frustration more kindly.
504118318··on sp.h: Fixing C by giving it a high quality, ultra portable standard library
Just taking a quick look at the atomics section:

First, (on unix) it's wrapping pthread mutex. That's part of libc! (Technically it might not be libc.so, but it's still the standard library.)

Also, none of the atomics talk about the memory model. You don't _have_ to use the C11 memory model (Linux, for example, doesn't). But if you're not using the C11 memory model and letting the compiler insert fences for you, you definitely need to have fence instructions, yourself.

While C11 atomics do rely on libgcc, so do the __sync* functions that this library uses (see https://godbolt.org/z/bW1f7xGas) for an example.

Oops... apparently this is vibecoded. Welp, I just wasted ten minutes of my life reviewing slop that I'm not going to get back.