From: Andrew MacLeod <amacleod@redhat.com>
To: Torvald Riegel <triegel@redhat.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [cxx-mem-model] Atomic C++ header file changes
Date: Fri, 19 Aug 2011 21:11:00 -0000 [thread overview]
Message-ID: <4E4EADA3.4090701@redhat.com> (raw)
In-Reply-To: <1313772528.3533.2376.camel@triegel.csb>
On 08/19/2011 12:48 PM, Torvald Riegel wrote:
>
>> The problem with issuing a warning is that anytime the compiler creates
>> a C++ atomic class and you use a method with a memory order, it usually
>> leaves an externally call-able method which has to take a runtime
>> value... so you'd see the warning on basically every compilation...
>> which in turn defeats the purpose of the warning.
>>
> Hmm. I would have assumed that the check that would raise warnings would
> be for actual calls, not for the instantiations. But that would probably
> require special handling of calls to the atomics class for all the
> integers and pointers (can atomic<T*> be handled as one thing?). So, if
> that's too much work, at least document the constraint somewhere?
>
>
I'd definitely document the constraint.
To be honest, I think its a pretty useless thing, bordering on moronic.
The whole point of the memory model is to be able to generate more
efficient code when you don't need SEQ_CST and really know what you are
doing.
Even if you *DO* want to make that kind of a call, you have to expect
the overhead of a runtime library call. And if you are using SEQ_CST
mode, its going to be that much slower again due to the call. I think
inlining it to be SEQ_CST will provide smaller code size always, and I'd
be surpised if it *ever* became a performance issue. And I do mean *ever*.
Andrew
next prev parent reply other threads:[~2011-08-19 18:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-17 17:54 Andrew MacLeod
2011-08-19 4:05 ` Richard Henderson
2011-08-23 23:24 ` Andrew MacLeod
2011-08-24 1:07 ` Richard Henderson
2011-08-24 3:09 ` Andrew MacLeod
2011-08-24 6:41 ` Richard Henderson
2011-08-19 10:17 ` Torvald Riegel
2011-08-19 13:22 ` Andrew MacLeod
2011-08-19 19:12 ` Torvald Riegel
2011-08-19 21:11 ` Andrew MacLeod [this message]
2011-08-24 17:25 ` Andrew MacLeod
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=4E4EADA3.4090701@redhat.com \
--to=amacleod@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=triegel@redhat.com \
/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).