Didier Kryn said on Sun, 3 Nov 2024 11:45:45 +0100
>Le 03/11/2024 à 02:09, Steve Litt a écrit :
>> Perhaps another way would be to use assert (C) or pragma assert (Ada,
>> and be sure to pragma assertions(Assert => Check)) for the time
>> being, and as runtime errors are discovered, substitute real error
>> handling.
>
> Assert is most often used to check that a variable is in the
> proper
>range. In Ada you can get this automatic and invisible in the
>subprogram body, just by declaring properly the range of the
>variable. At every place the variable is assigned a value, Ada asserts
>that it is in the range, at compile time whenever possible, otherwise
>at runtime. If the value is not in the range it raises the exception
>Constraint_Error.
Good point, if one takes the time to properly assign types to
everything. And of course from my 3 weeks of studying Ada it seems to
me that the main point of Ada is to properly type everything.
Good point!
SteveT
Steve Litt
http://444domains.com