size_t index=-1;

Ola Fosheim Grøstaf via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Mar 17 22:20:35 PDT 2016


On Thursday, 17 March 2016 at 22:46:01 UTC, tsbockman wrote:
> In the same way, using `cast(ulong)` to pass `-1L` to a 
> function that expects a `ulong` results in a de-facto loss of 
> information, because that `-1L` can no longer distinguished 
> from `ulong.max`, despite the fundamental semantic difference 
> between the two.

Only providing modular arithmetics is a significant language 
design flaw, but as long as all integers are defined to be 
modular then there is no fundamental semantic difference either.

Of course, comparisons beyond equality doesn't work for modular 
arithmetics either, irrespective of sign...

You basically have to decide whether you want a line or a circle; 
Walter chose the circle for integers and the line for floating 
point. The circle is usually the wrong model, but that does not 
change the language definition...


More information about the Digitalmars-d-learn mailing list