GCC:
compile in gcc with option [-Wconversion]
, then you'll see that the compiler will issue the warning:
warning: conversion to 'char' alters 'double' constant value [-Wfloat-conversion]
LIVE DEMO
MSVC don't seem to be concerned about this at all:
VS2013 produces the following warning:
warning C4244: 'argument' : conversion from 'double' to 'char', possible loss of data
even though it is clearly wrong and doesn't actually work anyway!
It's not wrong, it's just an implicit conversion from the truncated double
2.3 to a char
with ASCII code 2 (start of text).