Posted Aug 2, 2012 15:16 UTC (Thu) by tvld
Parent article: ACCESS_ONCE()
"Concurrency is not built into the C language itself"
It is in C11, but not in prior versions.
"Given the kinds of hazards presented by optimizing compilers, one might well wonder why this kind of situation does not come up more often."
I believe we typically do want compilers to optimize code, so I don't understand the negativity towards compiler optimizations in the article (nor towards the folks that write those optimizations). If you're going to synchronize, you need to let the compiler know. It's unrealistic to expect C/C++ compilers to find out exactly which variables might be accessed in a multi-threaded fashion, and nobody would like the performance degradation that conservative assumptions for that would cause.
to post comments)