integer division with float result
0ffh
frank at frankhirsch.youknow.what.todo.net
Sun Nov 18 18:57:46 PST 2007
0ffh wrote:
> With return type overloading I get
> [...]
> foo(cast(int)i/j); // explicit int
> foo(cast(float)i/j); // explicit float
Oops; this is with syntactic sugar, BTW, as I was
just casting the first operand, not the expression.
Otherwise
foo(cast(int)(i/j)); // explicit int
foo(cast(float)(i/j)); // explicit float
(The current style example should work as it is.)
Regards, Frank
More information about the Digitalmars-d
mailing list