3 ms·
In C it's very simple volatile int cnt = 0x1000; while(cnt--) ;
by Gibbon1 7y ago
In C it's very simple
volatile int cnt = 0x1000;
while(cnt--)
;
- hoseja 7y agoI've grown so paranoid of optimizing compilers this wouldn't even cross my mind. But it is correct, right?
- AlbertoGP 7y agoNot OP, but the “volatile” qualifier should prevent the compiler from optimizing it out.
- Gibbon1 7y agoYeah should. Multicore super scalar processors make me nervous about my assumptions. I wouldn't put it past one of them to realize that the result is unused and nop it. It's always good to check.