From: Jim Wilson <jimw@sifive.com>
To: Chris Hall <gcc@gmch.uk>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: Should atomic_xxx() functions reject not-_Atomic() arguments ?
Date: Fri, 28 Feb 2020 15:23:00 -0000 [thread overview]
Message-ID: <CAFyWVaachvPRGXH7wBnH3Tv3eAjaABE2SvrXCzGJLJB-Y1OUDQ@mail.gmail.com> (raw)
In-Reply-To: <c339b5a2-1ac9-603d-a91d-4682533b8877@gmch.uk>
On Thu, Feb 27, 2020 at 7:20 AM Chris Hall <gcc@gmch.uk> wrote:
> Now, the Standard also tells us that _Atomic(uint64_t) and uint64_t may
> have different sizes, representations and alignment. So I guess:
> bar = atomic_fetch_add(&bar, 1) ;
> should be an error ?
__atomic_fetch_add accepts any integer or pointer type. So the fact
that _Atomic(uint64_t) and uint64_t may be different types is not a
problem, as long as they are still integer types. This works like an
overloaded function in C++.
https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/_005f_005fatomic-Builtins.html#g_t_005f_005fatomic-Builtins
Jim
next prev parent reply other threads:[~2020-02-28 1:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <72f6344e-d8b2-bab4-b047-63e298063492@gmch.uk>
2020-02-27 17:27 ` Chris Hall
2020-02-28 15:23 ` Jim Wilson [this message]
2020-02-28 21:04 ` Chris Hall
2020-03-06 16:17 ` Chris Hall
2020-03-06 17:46 ` Jonathan Wakely
2020-03-07 11:00 ` Andrew Haley
2020-03-07 19:27 ` Jonathan Wakely
2020-03-07 13:04 ` Chris Hall
2020-03-07 19:29 ` Jonathan Wakely
2020-03-08 20:11 ` Martin Sebor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFyWVaachvPRGXH7wBnH3Tv3eAjaABE2SvrXCzGJLJB-Y1OUDQ@mail.gmail.com \
--to=jimw@sifive.com \
--cc=gcc-help@gcc.gnu.org \
--cc=gcc@gmch.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).