|
|
|
|
|
by pcvarmint
3413 days ago
|
|
It means that empty loops (loops with empty bodies) can be completely removed if the controlling expression has no side effects. > This is intended to allow compiler transformations such as removal of empty loops even when termination cannot be proven. It means while(i) {} can be eliminated as if i were 0, because there are no side effects in the loop expression or the loop body, and what would be the point of the loop if it never terminated on a non-constant expression? As an optimization, the optimizer is allowed to eliminate it as a useless loop with no side effects. If you really want an infinite loop, you can use while (1) {}. There are cases where automatically generated C code might have empty loops which are useless. If you really want to go to sleep, use pause() or similar. An infinite loop eats up CPU cycles. |
|