Integer overflows

superdan super at dan.org
Sun Jul 6 13:00:20 PDT 2008


bearophile Wrote:

> A short article from July 01, 2008, shows that some people are re-inventing the integer overflows compiler check that Pascal/Delphi programmers have enjoyed for lot of years:
> 
> http://www.ddj.com/hpc-high-performance-computing/208801981
> 
> This time I am happy that history is repeating itself.

me 2 but the article is just a rant. we should demand this from languages and computers. well yeah i demand a cow with diet coke too. 

i was always unclear on somethin'. should the check be in the operation or the type of the operand? i mean maybe i have some data and only sometimes i want to make sure there's no overflow. so i'm sayin'

int a, b, c;
a = b _+_ c;

or something. that _+_ is checked and shit. or should i be like

Safe!(int) a, b, c;
a = b + c;

arguments could go both ways i guess. the advantage of the albeit uglier first solution is that it is more likely to be used. somehow safe types keep on comin' in languages but people don't use'em if thery're not the default. positive bias i suppose. (ppl underestimate the likelihood of bad shit happening to'em and overestimate their capacity to avoid bad shit when it is imminent.)



More information about the Digitalmars-d mailing list