The latest draft C++ Standard is N3797, which states in 29.3 Order and consistency [atomics.order]/9:bob wrote:Seems that "should not allow" is pretty clear? It would seem to me if it says "should not allow" and your compiler allows that, it violates the standard?kbhearn wrote:Technically the quote in the first example still almost exists in the current working draft.
http://isocpp.org/files/papers/N3690.pdf
'discouraged from allowing' changed to 'should not allow'. Regardless, my question was answered a couple dozen postings ago as to how it doesn't break the requirements put forth in the standard. The elaborations that in practical terms it'd never happen anyway were also appreciated. I'd ask that the circle of insults stop but i think the two of you must rather enjoy it.
Which makes perfect sense since current hardware can not pull this off...
It is important to know how to read an ISO Standard. In particular, appendix H.2 of the ISO/IEC Directives states that the wording "should not" is to be interpreted as "it is not recommended that" or "ought not to". In fact, H.2 states that9 Implementations should ensure that no “out-of-thin-air” values are computed that circularly depend on their
own computation.
[ Note: For example, with x and y initially zero,should not produce r1 == r2 == 42, since the store of 42 to y is only possible if the store to x stores 42,Code: Select all
// Thread 1: r1 = y.load(memory_order_relaxed); x.store(r1, memory_order_relaxed); // Thread 2: r2 = x.load(memory_order_relaxed); y.store(r2, memory_order_relaxed);
which circularly depends on the store to y storing 42. Note that without this restriction, such an execution
is possible. — end note ]
This is different from "shall not", which is to be interpreted as "is not allowed [permitted] [acceptable] [permissible]", "is required to be not", "is required that … be not", or "is not to be".The verbal forms shown in Table H.2 shall be used to indicate that among several possibilities
one is recommended as particularly suitable, without mentioning or excluding others, or that a
certain course of action is preferred but not necessarily required, or that (in the negative form)
a certain possibility or course of action is deprecated but not prohibited.