Can we drop cast from float to int ?

#ponce ponce.remove-me at adinpsz.org
Mon Mar 22 16:12:50 PDT 2010


I never knew exactly what the float-to-int C cast is supposed to do. 

float f = whatever();
int b = cast(int) f;


Does it truncate, floor or round ? Or even undefined, depending on the rounding mode ? I just asked to 3 fellow programmers, it seems like i'm not the onlyone to find this confusing.

Why should a destructive cast should be _that_ implicit anyway ?



More information about the Digitalmars-d mailing list