lukeg lukeg - 5 months ago 10
C++ Question

Standard C++ transactional memory status

What is the current status of transactional memory proposal for C++17. Is it going to be included in the standard, aimed at being included in some future version of standard C++ or is only an experimental proof-of-concept feature, with its standardization status still undetermined?

I'm asking because some of the standardization committee's documents seem to give contradictory communication here. On the one hand we have P0265R0 ( saying that transactional memory is not going to be standardized, on the other hand - there's a N4492 paper by Stroustrup ( with transactional memory listed in C++17 feature list.


Shortly enough: the transactional memory TS is already published, and a second version is being developed. However, the committee does not plan to include it in the standard in the near feature. There are several reasons for this choice:

  • There isn't enough implementation experience. Only g++ implements it since GCC6. The goal of TSs is partly to gather implementation and user experience, so such a big feature is still too « immature » with regard to that.

  • Not every target supports transactional memory, and it has a high implementation cost while not everyone needs it. For these reasons, the committee is apparently unsure whether the TS should be part of the main C++ standard at all. It might as well forever live as a TS.

  • Moreover, not everyone believes that every feature of the transactional memory TS are worth being included in the main C++ standard. Some find that synchronized is the main feature, while other believe that atomic blocks are the real game changer. The TS does add another cognitive overhead that library implementers will have to deal with (as well as several new keywords, which isn't generally seen as a good thing).