On 06/28/2012 01:50 PM, Dmitry Timoshkov wrote:
> Michael Stefaniuc <mstef...@redhat.com> wrote:
> 
>>> truncating from double to float while gcc keeps silence for instance.
>> I never looked at that but I assume the same holds true as above.
> 
> The following thread has some interesting details:
> http://www.daniweb.com/software-development/c/threads/114052/warning-c4305-truncation-from-double-to-float
WOW, that's pretty stupid. "0.1" has no type, it is a numeric literal.
Type is inferred from the context and only if that isn't possible it
will fall back to the intrinsic type. You can even say "int i = 0.1;"
and that is correct C.

gcc -Wall -Wextra does not complain about the examples in the thread you
quoted as that is the correct C behavior. MSVC is a C++ compiler beaten
into submission to do C. And C++ perverted C.

bye
        michael



Reply via email to