- #36
Vanadium 50
Staff Emeritus
Science Advisor
Education Advisor
2023 Award
- 35,005
- 21,683
FWIW, this is Program 16-5 in Gaddis, which uses variable names that are un-yungmanized (e.g. myRectangle instead of myRect) and does not mix ints and doubles. So it is not the case that this is an exact copy. Would have saved some time.
I'm glad VS produces a warning for this. It would have been helpful for us to know that the code threw a warning. Would have saved some time.
But anyway...One thing Ada got right is that even Integers have ranges: you can't assign an Integer of one range to another that does not completely contain the first. One thing they got wrong was building in a default Integer type (and worse, with an implementation-dependent range). If you are going to have super-strong typing, have super-strong typing.
The advantage of this is that run-time errors in C/C++ become compile-time errors in Ada.
I'm glad VS produces a warning for this. It would have been helpful for us to know that the code threw a warning. Would have saved some time.
But anyway...One thing Ada got right is that even Integers have ranges: you can't assign an Integer of one range to another that does not completely contain the first. One thing they got wrong was building in a default Integer type (and worse, with an implementation-dependent range). If you are going to have super-strong typing, have super-strong typing.
The advantage of this is that run-time errors in C/C++ become compile-time errors in Ada.
Last edited: