unsigned int值没有给出正确的结果

Sur*_*uri 3 c++

下面的程序应该打印"错误",但它的打印成功.为什么?

#include<iostream>
using namespace std;
int main()
{ 
   unsigned int a;
   a=-10;

   if(a == -10)
        cout << "success" ;
   else
        cout << "error" ;

   return 0;
}
Run Code Online (Sandbox Code Playgroud)

Ign*_*ams 6

用于比较的转换使它们再次相等.但它应该导致编译器发出警告.