Real implicitly converts to float?

Ola Fosheim Grøstad via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jun 24 21:18:57 PDT 2016


On Friday, 24 June 2016 at 20:10:16 UTC, Tofu Ninja wrote:
> I am glad I was not the only one who thought that sounded a 
> little crazy... I thought D was supposed to be type safe. I 
> think I will make a bug report and see where that goes.

It is one of those cases where it made sense in C because it puts 
the burden on the programmer and the C-convention is to have the 
type in the name so it is "somewhat explicit" in C. C++ compilers 
solve this by having warning-options for float->double and also 
double->float conversions.

The conversion becomes rather problematic if you use Infinity to 
mean an open-ended interval. It means that a closed interval can 
implicitly be converted into an open-ended interval... :-/



More information about the Digitalmars-d-learn mailing list