Compiler Warning (level 2) C4244
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Compiler Warning (level 2) C4244

Error Message

'argument' : conversion from 'type1' to 'type2', possible loss of data

A floating point type was converted to an integer type. A possible loss of data may have occurred.

If you get C4244, you should either change your program to use compatible types, or add some logic to your code, to ensure that the range of possible values will always be compatible with the types you are using.

C4244 can also fire at level 3, and 4; see Compiler Warning (levels 3 and 4) C4244 for more information.


The following sample generates C4244:

// C4244_level2.cpp
// compile with: /W2

int f(int x){ return 0; }
int main() {
   double x = 10.1;
   int i = 10;
   return (f(x));   // C4244
   // try the following line instead
   // return (f(i));
© 2016 Microsoft