4 ms·
In gcc there are some pragmas you can use to to this: for instance `#pragma gcc optimize("O0")` should work. https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Func
by Moral_ 12y ago
In gcc there are some pragmas you can use to to this:
for instance `#pragma gcc optimize("O0")` should work.
https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Function-Specific-Option-Pragmas.html https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Function-Specif...
But the whole "this code might be removed during optimization" isn't exactly true. The compiler has to keep the meaning of your code the same. But once you introduce undefined behavior into the code, everything is meaningless from then on and gcc can do tons of wacky stuff.