This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] libstdc++: Add mem_order_hle_acquire/release to atomic.h


On Fri, Nov 09, 2012 at 07:56:21PM +0000, Jonathan Wakely wrote:
> >> constexpr memory_order
> >> operator|(memory_order __m, __memory_order_hle_mod __mod)
> >> {
> >>     return memory_order(__m | __mod);
> >> }
> >>
> >> This ensures users *cannot* call a.store(1,
> >> __memory_order_hle_acquire) because it's the wrong type, but they
> >
> > They would get a warning in any case.
> 
> Only if a compile-time constant is used, if it's passed in as a
> function parameter it won't be:

gcc will error out if the result is not constant. builtins.c
needs to see a number to generate the right instructions.

Ok that is why the constexpr was added originally I suppose?
Good that you added it back.

-Andi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]