3 ms·
Generic and atomic are inventions where the prior art was much better. Function overloading via name mangling is simpler, faster and composes better than generi
by JonChesterfield 3y ago
Generic and atomic are inventions where the prior art was much better. Function overloading via name mangling is simpler, faster and composes better than generic. Atomic as an operation (the gcc intrinsics) works better than as a type qualifier, especially given the type aliasing -> UB idea. Mostly because atomic is a property of something like "load" or "add", not of a register or an address.
I'm pretty sure whole program optimisation can do the majority of the performance work of the aliasing assumptions. Things like signed integers never overflow are more difficult. My pet theory is that a C compiler that emits machine code that follows a thin layer over the target assembly for semantics will be fast enough for most things C gets used for.
- steveklabnik 3y agoAh thanks. I have never used _Generic, but I fully agree that "atomics as an operation rather than a type qualifier" is the superior design.