I only realized that you are using a Microsoft product, but I will leave this answer as it can help someone else.
Have you looked at the compiler keys? I guess there is a similar option.
OMG! I was just looking for help in Visual Studio settings and alerts! ( link )
I am so sorry! I did not know! This is one of the most useful lists of options and switches I've ever seen! Even more ironically, they began to clear StackOverflow for answers and links here.
But I found some clues:
Compiler Warning (Levels 3 and 4) C4244 - Conversion from "type1" to "type2" conversion, possible data loss
Used this way:
// Enable this to find unintended double to float conversions. // warning C4244: 'initializing' : conversion from 'double' to 'float', possible loss of data
Switches
GCC / g ++ (
Why not tell the compiler when you accidentally do this?
From the g ++ / gcc man page:
-Wdouble-promotion (C, C++, Objective-C and Objective-C++ only) * Give a warning when a value of type "float" is implicitly promoted to "double". ... some verbage clipped ... * It is easy to accidentally do computations with "double" because floating-point literals are implicitly of type "double".
Adding -Wdouble-promotion to your CXXFLAGS should contain compilation warnings.
There is also -fsingle-precision-constant , which prohibits the implicit conversion of floating-point numbers to double.
source share