I VERY strongly disagree with this idea, this is a horrible idea for compatibility between the languages.
What are you thinking OP? Do you really hate C software that much?
My suggestion is to define <atomic> to include <stdatomics.h> and redefine what you need for C++ there.
I VERY strongly disagree with this idea, this is a horrible idea for compatibility between the languages.
What are you thinking OP? Do you really hate C software that much?
They are already incompatible. This is just making the error message
explain why and happen early.
My suggestion is to define <atomic> to include <stdatomics.h> and redefine what you need for C++ there.
That's not possible without violating the C++ standard. You can tell
from a C++ program whether atomic_int (for example) is a typedef of
"std::atomic<int>" or "_Atomic(int)", and changing it would break ABI
compatibility. It's simply not on the table.
However, you might be pleased to hear that the C++ committee is
working on making the two properly compatible for a reasonable subset
of uses. That has to be reasonably carefully coordinated to make sure
as little as possible breaks.
The approach is essentially the reverse of what you're proposing: add
a C++-specific stdatomic.h that makes common things like atomic_int,
_Atomic(int) work. Adding it now would be premature, but keep a look
out.
Cheers.
Tim.