[RFC] Make <atomic> and <stdatomic.h> explicitly incompatible

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[RFC] Make <atomic> and <stdatomic.h> explicitly incompatible

Yaron Keren via cfe-dev
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.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [RFC] Make <atomic> and <stdatomic.h> explicitly incompatible

Yaron Keren via cfe-dev
On 12 March 2018 at 21:22, Marcus Johnson via cfe-dev
<[hidden email]> wrote:
> 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.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev