Compartir a través de


Advertencia del compilador (nivel 4) C4245

"conversion": conversión de "type1" a "type2", no coinciden signed/unsigned

Observaciones

Intentó convertir un tipo signed const que tiene un valor negativo a un tipo unsigned.

Example

En el ejemplo siguiente se genera la advertencia C4245:

// C4245.cpp
// compile with: /W4 /c
const int i = -1;
unsigned int j = i; // C4245

const int k = 1;
unsigned int l = k; // okay

int m = -1;
unsigned int n = m; // okay

void Test(size_t i) {}

int main() {
   Test( -19 );   // C4245
}