On 08/19/2011 04:57 AM, Torvald Riegel wrote:
On Wed, 2011-08-17 at 11:39 -0400, Andrew MacLeod wrote:
That would be quite ugly, and you get what you deserve if you do that.
I changed the builtins so that if you dont specify a compile time
constant in the memory model parameter, it will simply default to
__SYNC_MEM_SEQ_CST, which will always be safe.  That is standard
compliant (verified), and if anyone is really unhappy about it, then the
c++ headers can be really uglified by adding a bunch of switch
statements to handle this twisted case.
IMHO this behavior should be documented so that users will be aware of
it, and it would be best if this would raise a warning. Note that I also
cannot see any reason why a programmer might want to make barriers
runtime-configurable, but silently adding overhead (perhaps the
parameter was supposed to be a constant, but wasn't?) can lead to more
confusion than necessary.


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.

Andrew


Reply via email to