[libcxx-commits] [PATCH] D58201: Make std::memory_order an enum class (P0439R0)

Jonathan Wakely via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 13 16:15:56 PST 2019


jwakely added inline comments.


================
Comment at: include/atomic:603
+
+#endif
 
----------------
zoecarver wrote:
> jfb wrote:
> > jwakely wrote:
> > > jfb wrote:
> > > > I think you want to keep the old `typedef enum memory_order` before C++20, and only enable the new thing in C++20 and later.
> > > That's what we did for libstdc++.
> > You did what I'm suggesting, or what @zoecarver did? 🤔
> Changing how `memory_order ` is defined changes how some of the code below is written -- if it is defined differently for different version then the code below also needs to be changed for different versions (actually a `static_cast` would work in both cases but it is only necessary in the latter). 
We did what you suggested: keeping it unchanged for C++11/14/17 and only making it a scoped enumeration (and adding the new enumerators) for C++20.

And we cast to `int` unconditionally, because as zoecarver said, that always works, even if the cast is redundant for C++11/14/17.


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58201/new/

https://reviews.llvm.org/D58201





More information about the libcxx-commits mailing list