Visual Studio 2010 (C++): suppress C4706 warning temporarily

后端 未结 5 869
萌比男神i
萌比男神i 2021-02-13 17:33

When you compile the following C++ source file in Visual Studio 2010 with warning level /W4 enabled

#include   // for printf
#include 

        
5条回答
  •  一个人的身影
    2021-02-13 18:10

    There is a simple construction !! to cast a type to bool. Like this:

    if (!!(result = strcmp(str0, str1)))
    

    However, in some cases direct comparison != 0 might be more clear to a reader.

提交回复
热议问题