Ada for Software Engineers (Second Edition with Ada 2005) - Errata

  • Page 38, program country3. The Second Edition uses the new Get_Line function in Ada 2005. It is in the declaration so that the variable S can be allocated according to the size of the string that is returned. End_Error is now raised in the declaration, so the exception cannot be handled in the block. Instead, it is propagated to the enclosing context and the handler should be in the main subprogram. (Thanks to David Pettersson.)
        declare                   -- Block begins here
          S: String := Get_Line;  -- Size of string from input
          when Constraint_Error => ...
        end;                      -- Block ends here
      end loop;
      when End_Error => null;
    end Country3;
  • Page 25, line 12: "some way is needed the separate" should be "some way is needed to separate". (Thanks to Arthur Salwin.)
  • Page 49, box: Array assignment is not allowed in C. However, an array can be "assigned" to a pointer variable, in which case a pointer to the first element is assigned. Similarly, if an array is an actual parameter, a pointer to the first element is passed. (Thanks to David Pettersson.)
  • Page 59, line -5: While it is true that the element can be returned in constant time, the data structure must be modified by moving all elements by one position (code line 39 on p. 61), so the entire operation is linear in the number of elements. (Thanks to David Pettersson.)
  • Page 369, line -5: the entry_body_formal_part should be
    entry E1(for D in Departments)(I: in Integer);

    (Thanks to David Pettersson.)