Full error message: warning C4244: ‘argument’ : conversion from ‘double’ to ‘int’, possible loss of data
Error occured on Visual Studio 2003 when compiling a C++ project.
The warning occurred because i was calling the abs function and i did not have included yet the math.h file. The reason that this warning appeared was due to the abs function that was already loaded with other libraries (stdlib.h) and it had only one defined as int abs(int) but I needed the double abs(double) overload. This way the compiler needed to let me know about the implicit cast from double to int.
double y = 1.2454; double x = abs((double)y);
The fix in my case is the following code added to the header of the file #include <math.h>