[University] Typo in question 5 of Type Safety

Rodrigo García rgarcia.garcia at gmail.com
Sat Nov 19 11:26:23 CET 2016


Dear AdaCore team,

To refresh my knowledge about Ada, I was taking a look at the courses that
you propose in the Ada University site.

In Programming in the Large, I have found out a typo in question 5 of
section Type Safety. The code snippet in the question is supposed to be
correct because, in contrast with the previous question, type T is declared
as a subtype instead of being a different type. However, the subtype
constraints in question 5 also change with respect to question 4: the range
starts with 1 instead of 0.

The code in question 5 raises thus Constraint Error when assigning V1
(whose value is 0) to V2:

   subtype T is Integer range 1 .. Integer'Last;
   V1 : Integer := 0;
   V2 : T := V1;

Apart from that, keep up the good work! Hope to see Ada 2012 specific
courses in the near future!

Kind regards,
Rodrigo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/university/attachments/20161119/d9b4fb7d/attachment.html>


More information about the University mailing list