This code
int main() {
double d = 3.14;
float f = d;
}
generates a warning with Vision C++ 2015 express:
warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
I would love to also see a warning like this when compiling with Clang (or GCC). Is there a command line option for this? -Wconversion
does not help here.
I'm sorry. I mixed up two compile bash scripts I was using. So I thought I had -Wconversion enabled, but it actually was not. -Wconversion
does help indeed.