| ▲ | spacedcowboy 6 hours ago | |
The number of times I might want to write something in C and have it less likely to crash absolutely dwarfs the number of times I care about that code being cross-platform. Sure, cross-platform is desirable, if there's no cost involved, and mandatory if you actually need it, but it's a "nice to have" most of the time, not a "needs this". As for mutex overheads, yep, that's annoying, but really, how annoying ? Modern CPUs are fast. Very very fast. Personally I'm far more likely to use an os_unfair_lock_t than a pthread_mutex_t (see the previous point) which minimizes the locking to a memory barrier, but even if locking were slow, I think I'd prefer safe. Rust is, I'm sure, great. It's not something I'm personally interested in getting involved with, but it's not necessary for C (or even this extra header) to do everything that Rust can do, for it to be an improvement on what is available. There's simply too much out there written in C to say "just use Rust, or Swift, or ..." - too many libraries, too many resources, too many tutorials, etc. You pays your money and takes your choice. | ||
| ▲ | woodruffw 5 hours ago | parent | next [-] | |
That’s all reasonable, but here’s one of the primary motivations from the post: > We love its raw speed, its direct connection to the metal If this is a strong motivating factor (versus, say, refactoring risk), then C’s lack of safe zero-cost abstractions is a valid concern. | ||
| ▲ | lelanthran 3 hours ago | parent | prev [-] | |
> As for mutex overheads, yep, that's annoying, but really, how annoying ? For this use-case, you might not notice. ISTR, when examing the pthreads source code for some platform, that mutexes only do a context switch as a fallback, if the lock cannot be acquired. So, for most use-cases of this header, you should not see any performance impact. You'll see some bloat, to be sure. | ||