編譯器警告 (層級 1) C4804
'operation' :作業中類型 'bool' 不安全的使用
當您以非預期的方式使用 bool
變數或值時,此警告為 。 例如,如果您使用負一元運算符 () 或補碼運算符 (-~
) 等運算符,就會產生 C4804。 編譯程式會評估表達式。
範例
下列範例會產生 C4804:
// C4804.cpp
// compile with: /W1
int main()
{
bool i = true;
if (-i) // C4804, remove the '-' to resolve
{
i = false;
}
}