编译器警告(等级 1)C4365

更新:2007 年 11 月

错误消息

“action”: 从“type_1”转换到“type_2”,有符号/无符号不匹配

例如,尝试将无符号值转换为有符号值。

默认情况下,C4365 为关闭状态。 有关更多信息,请参见Compiler Warnings That Are Off by Default

示例

下面的示例生成 C4365。

// C4365.cpp
// compile with: /W4
#pragma warning(default:4365)

int f(int) { return 0; }
void Test(size_t i) {}

int main() {
   unsigned int n = 10;
   int o = 10;
   n++;
   f(n);   // C4365
   f(o);   // OK

   Test( -19 );   // C4365
}