4 ms·
In GCC 4.4 and up you can use the following: #pragma GCC push_options #pragma GCC optimize ("O0") memset(a, 0, 3); #pragma GCC pop_options '
by coob 14y ago
In GCC 4.4 and up you can use the following:
#pragma GCC push_options
#pragma GCC optimize ("O0")
memset(a, 0, 3);
#pragma GCC pop_options
'volatile' should also work, I don't see why there is any need to rewrite memset. Here is a related question on SO:
http://stackoverflow.com/questions/2219829/how-to-prevent-gcc-optimizing-some-statements-in-c http://stackoverflow.com/questions/2219829/how-to-prevent-gc...
Edit: buried at the bottom of that post is another method:
__attribute__((optimize("O0")))