Re: Weirdness with clang and stdatomic.h on Rawhide

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 1 Feb 2022 at 09:15, Jonathan Wakely <jwakely@xxxxxxxxxx> wrote:
>
> On Mon, 31 Jan 2022 at 22:45, Ron Olson <tachoknight@xxxxxxxxx> wrote:
> >
> > Hey all,
> >
> > I’m troubleshooting an issue and came up with this sample program: https://pastebin.com/g9S8Z64q to demonstrate the problem.

That's not a valid C++ program, even in C++23 after <stdatomic.h> is added.

For C++23 it needs to be _Atomic(int) because in C++ _Atomic is not a
type qualifier (unlike in C). Clang supports the _Atomic qualifier in
C++ mode, but that's non-standard.

This code is not portable to any compiler except Clang, and is no
longer even portable to Clang when using G++ in C++23 mode.

I suppose we could enable the contents of <stdatomic.h> for the
non-strict -std=gnu++XX modes before C++23, but you'd still need to
adjust your program to use _Atomic(int) instead of _Atomic int.

Why not just write it in proper C++, using std::atomic<int> or the
atomic_int typedef instead?
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux