Dan Sugalski <[EMAIL PROTECTED]> writes: > .NET has exception-throwing versions of its math operations. If you do > an add of two 8-bit integers and the result overflows, you should get > an exception (if you've used the "check overflow" versions of the ops)
Actually, I thought about implementing Ada. The standard requires the following: 20. For a signed integer type, the exception Constraint_Error is raised by the execution of an operation that cannot deliver the correct result because it is outside the base range of the type. And this is painfully to implement if the machine doesn't support it (e.g. by overflow flags or trapping arithmetic). Unfortunately, in Ada, the base range of a type has to be known at compile time (at least if you want to use any existing compiler), so Ada needs fixed-width types, too.