Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 751 Bytes

compiler-warning-level-4-c4245.md

File metadata and controls

34 lines (26 loc) · 751 Bytes
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Warning (level 4) C4245
Compiler Warning (level 4) C4245
11/04/2016
C4245
C4245
85083d53-9cc2-4d12-b58c-6dad28f15cbe

Compiler Warning (level 4) C4245

'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch

You tried to convert a signed const type that has a negative value to an unsigned type.

The following sample generates 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
}