[e-lang] Defensive consistency and integer overflow
David Wagner
daw at cs.berkeley.edu
Sun Sep 23 17:23:32 EDT 2007
Mark Miller writes:
>Java and Joe-E have arbitrary precision integers. Unfortunately, Joe-E
>programmers tend to avoid them due to their costs, both notational and
>runtime. The notational costs could be fixed. At this point, the
>incremental bloat added to the Java language would, sadly, be a drop
>in the bucket.
Yup.
What did you have in mind for fixing the notational costs?
I can think of a solution based on transforming the Java/Joe-E source
code (though that seems potentially a bit unwieldy in practice for various
boring reasons) but I'm curious what you had in mind.
>What's the integer situation on C#/.NET?
C# has a "checked" keyword that seems like just what you'd want:
if arithmetic inside a "checked" block overflows, an exception is
thrown.
http://msdn2.microsoft.com/en-us/library/74b4xzyw(VS.71).aspx
http://www.codeproject.com/csharp/overflow_checking.asp
More information about the e-lang
mailing list