'int' is enough for 'length' to migrate code from x86 to x64
    via Digitalmars-d 
    digitalmars-d at puremagic.com
       
    Mon Nov 24 08:45:33 PST 2014
    
    
  
On Monday, 24 November 2014 at 16:00:53 UTC, ketmar via 
Digitalmars-d wrote:
> this *is* overflow. D just has overflow result defined.
So it basically is and isn't modular arithmetic at the same time? 
I think Ada got this right by providing the ability to specify 
the modulo value, so you can define:
type Weekday is mod 7;
type Byte is mod 256;
A solid solution solution is to provide «As if Infinitely Ranged 
Integer Model» where the compiler figures out how large integers 
are needed for computation and then does overflow detection when 
you truncate for storage:
http://resources.sei.cmu.edu/library/asset-view.cfm?assetid=9019
    
    
More information about the Digitalmars-d
mailing list