How to overcome pointless C++ compiler warnings elegantly?

后端 未结 7 866
迷失自我
迷失自我 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:16

    What could be -- realistically implementable -- more elegant that a single line of:

     #pragma warning ( suppress : 4127 )
    

    (I can't use this as I'm still on VS2005 where this doesn't work for all warnings.)

    Certainly, for your case for(;;) could be the pragmatic approach, but in general

    How to overcome pointless C++ compiler warnings elegantly?

    I'd say disable them project wide. (there pointless after all). And, to variate

    How to overcome false-positve C++ compiler warnings elegantly?

    I'd say, a single preprocessor line seems quite OK already.

    0 讨论(0)
提交回复
热议问题