Detecting inadvertent use of integer division

bearophile bearophileHUGS at lycos.com
Tue Dec 15 14:25:57 PST 2009


Nick Sabalausky:
> Reserving the only division operator for intdiv-only for the sake of C 
> compatibility would be terrible design.

Well, no, the (silly) idea is:

int / int => int
int \\ int => float
float / int => float
float \\ int => float
int / float => float
int \\ float => float
float / float => float
float \\ float => float

So the / is not just the int division. The only difference between the two operators is when you have (int,int).

Bye,
bearophile



More information about the Digitalmars-d mailing list