Can we drop cast from float to int ?

Jonathan M Davis jmdavisProg at gmail.com
Tue Mar 23 23:51:40 PDT 2010


#ponce wrote:

>> 
>> I've never considered anything but truncate.
>> 
>> Also how is it implicit?
> 
> Well, ok it's not. It's just that it seems to me that it's useless and
> confusing. If it's really trunc, I have seen countless errors where it was
> used as floor.

Maybe I've just never talked to enough programmers about it, but I've never 
talked to one who thought that it was anything other than truncate. I would 
have expected it to be mentioned in a decent C or C++ primer, but I haven't 
read any in a while, so I don't recally whether it's typical for it to be 
mentioned there. However, it is quite standard for C-derived languages to 
truncate when casting from float to integer.

- Jonathan M Davis



More information about the Digitalmars-d mailing list