PROPOSAL: Implicit conversions of integer literals to floating point

Alex_Dovhal alex_dovhal at yahoo.com
Thu Dec 30 11:46:06 PST 2010


"Don" <nospam at nospam.com> wrote:
>> Because the coder could have typed `0.0' instead of `0', the coder 
>> probably wanted the compile time error you described.
>
> No. People expect sqrt(2) to compile, and to return 1.414....
> For example, it works in C and in C++.
>
> The only other possible solution would be to disallow conversions 
> integer->floating point. I doubt that would be acceptable.
>

But people don't expect 1/2 to return 0.5000 and D isn't C++ 




More information about the Digitalmars-d mailing list