|
|
|
|
|
by RogerL
4446 days ago
|
|
In Ada you have subtype, so you would write subtype my_type is Integer range 0..10;
my_type x = 9;
my_type y = 10;
my_type a = x + y; So, obviously there is enough information to deduce at compile time that the sum operation yields an incorrect value. In practice, as many of the replies point out, you can determine no such thing (my_type x = user_input()). In that case Ada will throw a runtime exception. All this checking is expensive, so it ends up being much like C/C++, where you have debug and release builds, where the release builds do not do the checking. |
|