More on semantics of opPow: return type

bearophile bearophileHUGS at lycos.com
Mon Dec 7 11:37:47 PST 2009


Lars T. Kyllingstad:
> I'll even go as far as saying that I think 1/2 should either be an error 
> or a floating-point value -- or perhaps even a special rational type. 
> Integer division is not the same as "ordinary" division, and I think it 
> shouldn't use the same symbol. (A backslash would be better: 5\2 == 2)

In Pascal there's the 'div' operator for the integer division and / for the FP one. In Python they are // and / (even if the semantics is a bit different). Mixing the two is another bad detail of the C design.

Bye,
bearophile



More information about the Digitalmars-d mailing list