core.stdc.stdatomic

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Tue Nov 14 08:51:26 UTC 2023


Question: Why do people want another wrapper around some inline assembly 
that already exists in core.atomic?

Answer: they don't. This does not allow people to implement any new ideas.

We don't need another wrapper around the same inline assembly that has 
the exact same tradeoffs with inlinability (it can't be inlined) and 
without the ability to succinctly communicate with the backend to ensure 
codegen looks the way it needs to.

You want to port code from C? Use core.atomic, but wait it has different 
behaviors? Well yeah... its not designed around the intrinsics that 
stdatomic.h is that give it any useful meaning.

See: ``kill_dependency``, ``atomic_init`` and ``atomic_signal_fence``.

Writing a wrapper around stdatomic.h would take probably 2 hours. You 
don't need to write any inline assembly, its already done in 
core.atomic. But realistically all you're doing is changing some names 
and order of parameters with slightly different types.


More information about the Digitalmars-d mailing list