digitalmars.D - Integer overflows
- bearophile (5/5) Jul 06 2008 A short article from July 01, 2008, shows that some people are re-invent...
- superdan (9/14) Jul 06 2008 me 2 but the article is just a rant. we should demand this from language...
- Nick Sabalausky (21/45) Jul 06 2008 C# has a nice solution that involves (I think this is what they're named...
- superdan (2/61) Jul 06 2008 does that checked stuff see through function calls?
- Nick Sabalausky (4/72) Jul 06 2008 I would assume so, but I'd really have to look it up or do a test to be
- JAnderson (5/26) Jul 07 2008 This reminds me of ADA. It had this range and subrange types which you
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. Bye, bearophile
Jul 06 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.)
Jul 06 2008
"superdan" <super dan.org> wrote in message news:g4r88k$qjj$1 digitalmars.com...bearophile Wrote:"checked" and "unchecked" keywords. (Heh heh, yes, here I go praising just look up the whole "no IArithmetic" bizzareness. Anyway...)) The way it works is this: In the compiler settings, you can choose a default, either artithmetic is checked for overflows by default or not checked by default. Then, in the code, you can override the compiler setting by doing something like this: checked { // Code here } unchecked { // Code here } a = checked(b + c); a = unchecked(b + c);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.)
Jul 06 2008
Nick Sabalausky Wrote:"superdan" <super dan.org> wrote in message news:g4r88k$qjj$1 digitalmars.com...does that checked stuff see through function calls?bearophile Wrote:"checked" and "unchecked" keywords. (Heh heh, yes, here I go praising just look up the whole "no IArithmetic" bizzareness. Anyway...)) The way it works is this: In the compiler settings, you can choose a default, either artithmetic is checked for overflows by default or not checked by default. Then, in the code, you can override the compiler setting by doing something like this: checked { // Code here } unchecked { // Code here } a = checked(b + c); a = unchecked(b + c);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.)
Jul 06 2008
"superdan" <super dan.org> wrote in message news:g4rg1u$1en7$1 digitalmars.com...Nick Sabalausky Wrote:I would assume so, but I'd really have to look it up or do a test to be sure."superdan" <super dan.org> wrote in message news:g4r88k$qjj$1 digitalmars.com...does that checked stuff see through function calls?bearophile Wrote:named:) "checked" and "unchecked" keywords. (Heh heh, yes, here I go praising gimped - just look up the whole "no IArithmetic" bizzareness. Anyway...)) The way it works is this: In the compiler settings, you can choose a default, either artithmetic is checked for overflows by default or not checked by default. Then, in the code, you can override the compiler setting by doing something like this: checked { // Code here } unchecked { // Code here } a = checked(b + c); a = unchecked(b + c);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.)
Jul 06 2008
superdan wrote:bearophile Wrote:This reminds me of ADA. It had this range and subrange types which you could specify any range for a number and the runtime would validate it for you. They could also be passed in as ranges for arrays which was kinda neat.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.)
Jul 07 2008