How to overcome pointless C++ compiler warnings elegantly?

后端 未结 7 936
迷失自我
迷失自我 2021-01-01 10:12

This question is not bound to any specific compiler warning, the following is just an example.

Currently when I want a loop that checks an exit condition inside:

7条回答
  •  情深已故
    2021-01-01 11:03

    I'd go with for(;;) even without that warning. It's not stupid: it's a loop with no condition, which is exactly what you want to express.

    That seems more logical to me than using a while loop and testing that true is still true each time round the loop (of course the compiler will optimize away this test, so it won't actually affect performance).

提交回复
热议问题