I read quite a few questions about SO about guarantees of code execution in optimized code, so I am trying to compile a list of reasons that the compiler allows / stops the code sequence from being reordered.
I started the answer with what is generally true, but I did not add a quote from the standard (this was taken from my experience). I would ask you to add an answer if there is something that has been forgotten, or expand / correct the points that are there.
In addition, someone can check me if the code blocks are not subject to reordering. I.e.
void fn() { { ... } { ... } }
Is it possible for code in code block 1 mix or execute before code block 2 ?
source share