Condividi tramite


Avviso del compilatore (livello 4) C4245

'conversion': conversione da 'type1' a 'type2', signed/unsigned non corrispondente

Si è tentato di convertire un signed const tipo con un valore negativo in un unsigned tipo.

L'esempio seguente genera l'errore 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
}