4 ms·
A simple data race in C11/C++11 is undefined behavior, it doesn't have to result in any well-defined state that you might get by interleaving the execution of t
by bcoates 13y ago
A simple data race in C11/C++11 is undefined behavior, it doesn't have to result in any well-defined state that you might get by interleaving the execution of threads.
I think this has been on HN already: http://www.hpl.hp.com/personal/Hans_Boehm/c++mm/why_undef.html http://www.hpl.hp.com/personal/Hans_Boehm/c++mm/why_undef.ht...
Essentially it has to be that way, or on some architectures every access to a potentially shared variable would have to be wrapped in fences by the compiler.
- dllthomas 13y agoStrictly speaking, it could be implementation-defined behavior.