Errata in Ada as a Second Language, 2nd edition

Last updated: June 5, 2001


Items displayed in green and marked with the symbol were fixed in the second printing.

To determine whether you have the first or second printing of Ada as a Second Language, second edition, look at page iv (the copyright page, on the back of the title page). In the first printing, the line above the ISBN reads as follows:

     1 2 3 4 5 6 7 8 9 0 DOC DOC  9 0 9 8 7 6 5
In the second printing, this line reads as follows:
       2 3 4 5 6 7 8 9 0 DOC DOC 9 0 9 8 7
(These are both printings of the second edition of Ada as a Second Language, with the cover shown here. The second edition, which covers Ada 95 and Ada 83, is a substantial revision to the first edition, which covered only Ada 83. In contrast, the second printing is mostly the same as the first printing. When additional copies of a given edition must be printed, publishers often take the opportunity to make localized corrections that can be applied by replacing individual pages, without disturbing the contents of later pages.)

[ Pages 1-100 | 101-200 | 201-300 | 301-400 | 401-500 | 501-600 | 601-700 | 701-800 | 801-900 | 901-1000 | 1001-1100 | 1101-1133 ]

[Chapters 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 ]
[Appendices A | B | C | D | E ]
[Index]


Chapter 1. An Introduction to Ada


Page 15:
The character at the end of the third line from the bottom of the page should be a semicolon, not a comma:
   Ada.Integer_Text_IO.Put (Value);
[Reported by Toralf Wittner]

Page 28:
Ten lines below the declaration of Stack_Package_2, change the sentence
A type can only be declared private in the visible part of a package specification.
to the following:
A type can be declared private only in the visible part of a package specification.
[Reported by William R. Wagner]

Page 40:
In the first sentence of the second paragraph of Section 1.4, change "subset" to "superset".

[Reported by William R. Wagner]


Chapter 2. Elementary Ada Programming


Page 54:
On the last three lines of the page, change both occurrences of "Date_Type" to "Integer".

[Reported by Ken Dritz]


Page 57:
In the if statement at the bottom of the page, change < 9 to < 10.

[Reported by Ken Dritz]


Page 77:
On the fourth line, change "C iterate statement" to "C continue statement".

[Reported by Stephen J. Bevan]


Page 104 (fixed in second printing):
Exercise 2.6 calls for rewriting the procedure Decode with a case statement in place of the if statement, but in fact Decode contains no if statement!

Chapter 3. Type Declarations


Page 121:
On the line following the declaration of Digit_Type, change Digit_Subtype'First to Digit_Type'First and Digit_Subtype'Last to Digit_Type'Last .

[Reported by William R. Wagner]


Page 122:
Add the following paragraph to the end of Section 3.4:
The attributes 'Wide_Image and 'Wide_Value work in the same way as the 'Image and 'Value attributes, but deal with strings of Wide_Character values instead of strings of Character values. Such strings belong to the type Wide_String, which will be discussed further in Section 3.8.2. (The type Wide_Character was introduced in Section 2.3.2.)

[Reported by Ken Dritz]


Page 124:
(The last paragraph states that 'Wide_Image and 'Wide_Value attributes are described in Section 3.4, but they are not. See the erratum on page 122.)

[Reported by Ken Dritz]


Page 125:
In the second paragraph, change the first sentence to read, "The attribute T'Remainder(X,Y) is a generalization to real numbers of the remainder that results when X is divided by Y, but with a result in the range -Y/2.0 to Y/2.0 rather than zero to Y." In the third sentence of that paragraph, change "the equivalent value in the range from zero to just under 360.0" to "an equivalent value in the range from -180.0 to 180.0".

[Reported by Howard W. Ludwig]


Page 126:
(Near the end of the top paragraph, it is stated that the 'Wide_Image and 'Wide_Value attributes are described in Section 3.4, but they are not. See the erratum on page 122.)

[Reported by Ken Dritz]


Page 127:
On the line before the second declaration of Balance_Type, change "the range implied by the range and precision" to "the range implied by the scale and precision".

[Reported by Ken Dritz]


Page 128:
Change the syntax for a number declaration from
   identifier , ~~~ , identifier : constant := universal-expression ;

to
   identifier , ~~~ , identifier : constant := static-expression ;
Immediately afterward, replace the sentence "The universal expression must be static," and the subsequent parenthesized sentence with "The static expression must be numeric." (The initial value in a number declaration must be a static universal expression in Ada 83, but a static expression of any numeric type is allowed in Ada 95.)

[Correction refined following a suggestion by Keith Thompson]


Page 129:
Replace the last paragraph of Section 3.7 with the following:
Named numbers are static expressions and can be used in the static expressions of later number declarations:
     Radians_Per_Degree : constant := Pi / 180.0;
     Degrees_Per_Radian : constant := 1.0 / Radians_Per_Degree;
     Bits_Per_Word      : constant := 32;
     Max_Word_Value     : constant := 2**Bits_Per_Word - 1;

They can also be used in the static expressions of type declarations:
   type Word_Type is mod 2**Bits_Per_Word;
In fact, a named number declared with a universal integer expression or an expression of an ordinary integer type is itself a universal integer expression, and can be used anywhere an integer literal can be used; a named number declared with a univeral real expression or an expression of a floating-point or fixed-point type is itself a universal real expression, and can be used anywhere a real literal can be used.

Pages 131-132:
In the Count_Letters program, change each of the four occurrences of
     'A' .. 'Z'
to
     Character range 'A' .. 'Z'
and (for consistency, even though the language rules do not require it) make the same change in the expression
     Next_Character in 'A' .. 'Z'

occurring 8 lines before the start of Section 3.8.2.

[Reported by Ben Brosgol]


Page 133:
In the paragraph beginning "In an unconstrained array type" (about 3/4 of the way down the page), change "1 .. 10 and 1 .. 10" to "1 .. 10 and 1 .. 5".

[Reported by Ken Dritz]


Page 134:
On the last line of the last full paragraph, change "of each containing" to "each containing".

[Reported by Ken Dritz]


Pages 134-135:
Add the declaration
   type Integer_List_Type is array (Integer range <>) of Integer;

just after the declaration of N, and change the declaration of List to
   List: Integer_List_Type (1 .. N);
("One-of-a-kind" arrays are not introduced until Section 3.13.)

[Reported by Ken Dritz]


Page 135:
Eight lines from the bottom of the page, change "must contain an index constraint" to "must contain either an initial value or an index constraint".

[Reported by William R. Wagner]


Page 137:
In lines 4-5 of Section 3.8.3, change "any static universal-integer expression" to "any static expression of an integer type". (A static expression giving a dimension number in a 'First, 'Last, 'Range, or 'Length attribute is required to be of type universal_integer in Ada 83, but can be of any integer type in Ada 95.)

Page 138:
In the line just after the declaration of Working_Days_In_Week (about halfway down the page), change "the array Working_Days" to "the array Working_Days_In_Week".

[Reported by Ken Dritz]


Page 151:
Section 3.14 should note that Ada 83 requires universal expressions in the initial value of a number declaration and in an expression giving the dimension number in a 'First, 'Last, 'Range, or 'Length attribute.

Page 155:
Change the second sentence of the last paragraph on the page to read as follows:
All discrete types have a first and last value, a predecessor for each value except perhaps the first, a successor for each value except perhaps the last, a way to compare two values in the type to determine which is greater than the other, and subranges containing well-defined numbers of values.
(In a modular type, the first value has a predecessor and the last value has a successor.)

[Reported by William R. Wagner]


Chapter 4. Subtypes Versus Distinct Types


Page 174:
Replace the declaration of Day_Type in the first paragraph of Section 4.2.3 with the following declaration:
   subtype Weekday_Subtype is Day_Type range Monday .. Friday;

[Reported by Ken Dritz]


Page 179:
In the ninth line from the end of Section 4.4, insert an equals sign before "Day_Type'Pos(Monday)".

[Reported by Ken Dritz]


Page 186:
In the last sentence before the exercises, change "of type" to "of the type".

[Reported by Ken Dritz]


Page 187:
On the third line of Exercise 4.3, change "Non_Positive_Sign_Type" to "Non_Positive_Sign_Subtype".

Chapter 5. String Manipulation


Page 193:
In the second bullet in Section 5.4, change "instead of pad characters being inserted on the left, they can be inserted on the right" to "instead of pad characters being inserted on the right, they can be inserted on the left".

[Reported by Howard W. Ludwig]


Page 197:
In the call on Overwrite eight lines from the end of Section 5.6, change "4" to "5".

[Reported by Howard W. Ludwig]


Page 200:
In the third line of the last bulleted item, change "according the rule" to "according to the rule".

[Reported by Ken Dritz]


Page 201:
Change the penultimate sentence of the first paragraph to "Such types will be explained in Chapter 8."

[Reported by William R. Wagner]


Page 201:
In the second line of the second paragraph and the first line of the third paragraph, change "Character_Map" to "Character_Mapping".

[Reported by Ken Dritz]


Page 202:
In the third line of the first full paragraph, change "Ada.Characters" to "Ada.Characters.Handling".

[Reported by Ken Dritz]


Page 202:
On the fourth line of the first full paragraph, remove the word "other".

Page 203:
The discussion of the Index function taking a string-valued pattern should mention that the pattern is expected to be nonempty. The exception Ada.Strings.Pattern_Error is raised if Index is invoked with a pattern of length zero.

Page 206:
In the last sentence of Section 5.9, change "bounded-length" to "varying-length".

[Reported by Ken Dritz]


Page 210:
In Section 5.11.4.3, change the string written by the first call on Put from "bb123.45" to "bb123.46".

[Reported by Ken Dritz]


Page 218:
In the note at the top of the table, change the description of C from "a value of type Character" to "a variable of type Character" (since the example of a call on Element uses C as the target of an assignment).

[Reported by Ken Dritz]


Page 218 (fixed in second printing):
In the fourth entry from the bottom of the table, the entry in the first column should be:
   Replace_Slice (U, N, M, S);

Page 220:
Remove the Justify and Pad parameters from the first table entry. (These parameters of Ada.Strings.Fixed.Trim are described in the last bulleted item on the page.)

[Reported by Ken Dritz]


Page 221:
In the "Effect" column of the first table entry, change the description to
The set consisting of the character C, the characters in the string Str, the characters in the range C_Range, or the characters in one of the ranges of C_Range_List."
In the "Effect" column of the second and third table entries, change "S" to "S1".

[Reported by Ken Dritz]


Chapter 6. Expressions


Page 230:
In the sixth line of the last paragraph, change "A(J .. J)(M .. N)" to "A(I .. J)(M .. N)".

[Reported by Ken Dritz]


Page 240:
In the line of text just after the procedure body, change "A := B" to "B := A".

[Reported by Ken Dritz]


Page 245:
Replace the first two of the six equations at the end of the first paragraph of Section 6.2.4 with the following:
   (-X) mod Y    = 0 if X mod Y = 0, Y - (X mod Y) otherwise

   X mod (-Y)    = 0 if X mod Y = 0, (X mod Y) - Y otherwise

[Reported by Howard W. Ludwig]


Page 251:
In Figure 6.4, in the column labeled "Y", change the second entry to "False".

[Reported by Ken Dritz]


Page 258:
Delete the second paragraph from the bottom of the page (starting "In certain contexts ..."). (See errata on pages 128 and 137 for an explanation.)

Page 265:
In the "Right Operand" column, change the first entry from "subtype Positive" to "subtype Natural".

[Reported by Ken Dritz]


Page 267:
In Figure 6.6, in the middle entry of the "Result" column, change "operand" to "operands".

[Reported by Ken Dritz]


Chapter 7. Subprograms


Page 277:
On the seventh line, change "Fortran 90" to "Fortran 77".

[Reported by Ken Dritz]


Page 283:
In the second line of the first full paragraph, change "List" to "Increment_List".

[Reported by Ken Dritz]


Page 283:
In the List_Sum function body, change
   return List_Sum ( List (1 .. List'Last-1) ) + List (List'Last);
to
   return

      List_Sum ( List (List'First .. List'Last-1) ) +
      List (List'Last);
(This accounts for the possibility that the lower bound of List is not 1.)

[Reported by Ken Dritz]


Page 301:
In the first full paragraph on the page (beginning "The only clues..."), on the second line, change "Section 7.6" to "Section 7.6.1".

[Reported by William R. Wagner]


Page 308:
Change the last sentence of the paragraph beginning "Unless a subprogram" to "In the example above, the actual parameter X was modified under the name of the corresponding formal parameter, Y, and then examined under the name X (as a global variable)."

[Reported by Ken Dritz]


Page 308:
Remove the word "that" from the end of the fourth line of the last paragraph.

[Reported by Ken Dritz]


Page 310:
In the return statement about halfway down the page, change "String_Of_Type_Subtype" to "String_Of_10_Subtype".

[Reported by Ken Dritz]


Page 313:
In the first full paragraph on the page, change both occurrences of "are copied" to "are, in effect, copied". (As Section 7.9 explains, composite parameters may be passed by reference, but in a correct program the effect will be the same as that of copying.)

[Reported by William R. Wagner]


Chapter 8. Access Types


Page 322 (fixed in second printing):
In the parenthesized sentence just below the assignment
   P := N'Access;

the C assignment "p=n" should read "p=&n".

[Reported by Stephen J. Bevan]


Page 331:
In the last paragraph on the page, change the first two declarations to
   type Natural_Pointer_Type_1 is access all Natural;
   type Natural_Pointer_Type_2 is access all Natural;

[Reported by Jean-Etienne Doucet]


Page 334:
On the penultimate line on the page, change "Message_Process_Pointer_Type" to "Message_Processor_Pointer_Type".

[Reported by William R. Wagner]


Page 344 (fixed in second printing):
The sequence of statements in the middle of the page uses a variable New_Size whose declaration is not shown at the top of the page. The declaration should be:
   New_Size     : Natural;

[Reported by Moti Ben-Ari]


Page 357 (fixed in second printing):
In Illegal_Program_3, the first declaration should be
   type Procedure_Pointer_Type is access procedure;

[Reported by Moti Ben-Ari]


Page 354:
In the syntax of a parameter specification for an access parameter, ignore the smudge that appears to be a raised dot after the text
   identifier , ~~~ , identifier :

[Reported by Ken Dritz]

Page 367:
On the fifth line of the second full paragraph on this page, change "pointed to an access parameter" to "pointed to by an access parameter".

[Reported by William R. Wagner]


Chapter 9. Types with Discriminants


Page 382:
In the last declaration, change "Domestic_Address_Subtype" to "US_Address_Subtype".

[Reported by Ken Dritz]


Page 389:
In the allocator on the first line, change "Mailing_Address_Pointer_Type" to "Mailing_Address_Type".

[Reported by Ken Dritz]


Page 391:
On the first line of the last paragraph on the page, change "a a mutable object" to "a mutable object".

[Reported by William R. Wagner]


Page 393:
In the first line following the procedure body, change "each of its parameters" to "its second parameter".

[Reported by Ken Dritz]


Page 397:
In the aggregate at the top of the page, change "Maximum_Length" to "Capacity" and "Current_Length_Part" to "Current_Size_Part".

[Reported by Ken Dritz]


Chapter 10. Packages


Page 407:
On the fifth line of the second full paragraph, change "subprogram declared in a package body" to "subprogram whose body occurs inside a package body".

[Reported by Ken Dritz]


Page 448:
On the last line, insert "the" after "of".

[Reported by Ken Dritz]


Chapter 11. Private and Limited Types


Page 469 (fixed in second printing):
The first two lines of the child package are partly obscured. They should read:
   package Integer_Lists.Cursors is

      type Cursor_Type is private;

[Reported by Moti Ben-Ari]


Page 469 (fixed in second printing):
The full declaration for List_Cell_Type in the private part of the Integer_Lists package declaration should be changed to:
   type List_Cell_Type (Is_Header_Cell: Boolean) is
       record
          Forward_Link_Part  : List_Type;
          Backward_Link_Part : List_Type;
          case Is_Header_Cell is
             when False =>
                Item_Part: Integer;
             when True =>
                null;
          end case;
       end record;

This change makes it possible for the Predecessor and Successor functions declared in the child package Integer_Lists.Cursors to distinguish the list header from ordinary list cells, and thus to detect an attempt to generate a cursor pointing before the first item or after the last item in a list.

Pages 491-492:
Delete the example involving Cell_Type and List_Type (everything from the words "For example, given the declarations" in the second full paragraph on page 491 until the end of that paragraph, along with Figure 11.1 on page 492).

On page 492, add the following paragraph to the end of Section 11.9:

The object pointed to by T'Access, where T is a limited record type, is considered shorter-lived than type T. Suppose there is an explicitly declared access type A that can point to objects of type T and type T has a record component C belonging to type A (i.e., the types are recursive). Then type A is necessarily also longer-lived than the object pointed to by T'Access, so the Access-Type Lifetime Rule (see Section 8.8) prevents you from using T'Access as the initial value of component C. You can write T'Unchecked_Access instead of T'Access, in which case the Access-Type Lifetime Rule does not apply, but this is dangerous because it can result in dangling references (if the value of X.C,where X is an object of type T, is assigned to some variable of type A that is longer-lived than X).

[Reported by Stanley Allen]


Page 495:
In the syntax for the declaration of a limited record type, the word "limited" should not be marked as optional.

[Reported by Ken Dritz]


Page 497 (fixed in second printing):
(See the second erratum on page 469 before attempting Exercise 11.6.)

Chapter 12. Classwide Programming


Page 517:
Near the end of the first paragraph, change both occurrences of "Parent_Type" to "Ancestor_Type".

[Reported by Ken Dritz]


Page 530:
In the if statement in Print_And_Accumulate, change 0 to 0.0. In the subsequent assignment statement, change Transaction.Amount to Transaction.Amount_Part.

Page 532:
On the fourth line, change "Section 12.3.3" to "Section 12.3.4".

Page 552:
On the eighth line of Section 12.4.5, change "Section 12.3.3" to "Section 12.3.4".

Page 553:
On line 1 and lines 6-7 of the second paragraph, change "Section 12.3.3" to "Section 12.3.4".

[Reported by Jean-Etienne Doucet]


Page 554:
Move the function declaration for Description into the visible part of package Transactions. If an abstract type is declared in the visible part of a package specification, its explicitly declared abstract subprograms must also be declared there.

[Reported by John J. Cupak, Jr.]


Page 572:
On the third line of the second bulleted item, change "may given" to "may be given".

[Reported by Ken Dritz]


Page 581:
In the two lines following the sequence of declarations, change both occurrences of "X2" to "Y1", so that the sentence reads, "...the comparison X1 = Y1 compares X1.Term_Part with Y1.Term_Part and X1.Meaning_Part with Y1.Meaning_Part...." In the fourth and fifth lines from the bottom of the page, replace the third and fifth occurences of "X2" with "Y2", so that the sentence reads, "However, the comparison X2 = Y2 compares X2.Term_Part with Y2.Term_Part and X2.Meaning_Part with Y2.Meaning_Part ...."

[Reported by Larry Kilgallen ]


Page 583:
Change the declaration of Cents_Type to
   type Cents_Type is range -1E8 + 1 .. 1E8 - 1;

[Reported by Howard W. Ludwig]


Page 587:
In the eighth line of the second full paragraph, change "program" to "subprogram".

[Reported by Ken Dritz]


Page 589:
Exercise 12.2 refers to "package United_States_Phone_Numbers in Section 12.3.4," but such a package is not explicitly shown in that section. Rather, on page 519, a package Canadian_Phone_Numbers is shown, and it is stated that "Packages of the same form can be written for other countries in the North American phone system." United_States_Phone_Numbers is meant to be one of these packages, providing a type named United_States_Phone_Number_Type.

Chapter 13. Separate Compilation


Page 593:
In the fifth line of the last paragraph of Section 13.1.2, change "A compilation" to "A compilation unit".

[Reported by Ken Dritz]


Page 614:
Remove the word "in" from the end of the second line of the second bulleted item.

[Reported by Ken Dritz]


Page 615:
In the with clause and initialization statements for the Cached_Sines package body, and in the first line of text following the package body, change "Ada.Float_Elementary_Functions" to "Ada.Numerics.Elementary_Functions".

[Reported by Ken Dritz]


Page 617-618:
In the with clause and initialization statements for the Cached_Sines package body, change "Ada.Float_Elementary_Functions" to "Ada.Numerics.Elementary_Functions".

[Reported by Ken Dritz]


Page 619:
In the seventh line of the first paragraph, change "bodies all" to "bodies of all".

[Reported by Ken Dritz]


Chapter 14. Exceptions


Page 647:
In the fourth line on the page, insert "to" after "conforming".

[Reported by Ken Dritz]


Page 658:
On the third line, change "value" to "variable".

[Reported by Ken Dritz]


Page 658:
On the eighth line of the first full paragraph, change "it" to "its".

[Reported by Ken Dritz]


Page 665:
In the fifth line of the first full paragraph, change "elaboration or the package body" to "elaboration of the package body".

[Reported by Ken Dritz]


Chapter 15. Generic Units


Page 691:
In the Generic_List_Function function body, the assignment to Result(I) should be to Result(Result'First+I) instead.

[Reported by Ken Dritz]


Page 702:
On the first line, change "third" to "second".

[Reported by Ken Dritz]


Pages 714-715:
Change the first sentence of Section 15.2.3.8 to, "Generic formal private types and generic formal tagged types may have discriminants."

On page 715, remove the sentences giving the forms for a generic formal untagged derived type with discriminants and a generic formal tagged derived type with discriminants.

(See also errata on pages 735-736.)

[Reported by Corey Minyard]


Page 716 (fixed in second printing):
The word with is missing from the syntax of generic formal packages. In the third paragraph of Section 15.2.4, the second line should read
   with package identifier is new generic-package-name ( <> ) ;

and lines 6-9 should read:
   generic
      with package Instance is new Abstraction ( <> );
      ...
   procedure Client_Template ... ;

(See also errata on pages 719 and 736.)

[Reported by David Weller]


Page 719 (fixed in second printing):
The word with is missing from the syntax of generic formal packages. The syntax description at the bottom of the page should read:
 with package identifier is
    new generic-package-name

       .................................................................
       : ( generic-actual-parameter , ~~~ , generic-actual-parameter ) : ;
       .................................................................

(See also errata on pages 716 and 736.)


Page 722 (fixed in second printing):
The with clause at the top of the page is legal, but unnecessary, and should be deleted. A child unit never needs a with clause for its parent.

Page 723:
Insert "the" at the end of the fifth line of the first paragraph.

[Reported by Ken Dritz]


Pages 735-736:
In the last bullet on page 735, change "private, tagged, or derived" to "private or tagged". On the top of page 736, remove the two syntax descriptions preceding the words "In this case".

(See also errata on pages 714-715.)

[Reported by Corey Minyard]


Page 736 (fixed in second printing):
The word with is missing from the syntax of generic formal packages. The syntax descriptions just below the middle of the page should read:
 with package identifier is new generic-package-name ( <> ) ;
 with package identifier is
    new generic-package-name

       .................................................................
       : ( generic-actual-parameter , ~~~ , generic-actual-parameter ) : ;
       .................................................................

(See also errata on pages 716 and 719.)


Page 736:
Eight lines from the bottom of the page, change "In addition, for a generic actual parameter of the first form, a generic actual parameter associated with the instance can be referred to as if it were one of the facilities provided by the instance," to "In addition, for a generic formal package of the first form, a generic formal parameter of the named generic package can be referred to as if it were one of the facilities provided by the instance."

[Reported by Ken Dritz]


Page 738 (fixed in second printing):
In Exercise 15.6, in the second bullet, change Merge_Groups (X, Y) to Merge_Groups (X'Access, Y'Access). In the third bullet, change In_Same_Group (X, Y) to In_Same_Group (X'Access, Y'Access). (This change facilitates the implementation described in the exercise, which requires In_Same_Group to modify hidden data associated with X and Y.)

Page 738 (fixed in second printing):
In Exercise 15.7, change "An edge is a pair of values in the extended type for nodes. The array is assumed to already have been sorted in order of ascending edge cost," to "An edge includes two access values pointing to objects in the extended type for nodes. The array is assumed to already have been sorted in order of ascending edge cost. Two edges with a common node are assumed to contain access values pointing to the same node object."

Chapter 16. Predefined Input and Output


Page 742:
On the sixth line of Section 16.1.2, insert "a" after "representing".

[Reported by Ken Dritz]


Page 743:
On the second line of 16.2, change "files" to "packages".

[Reported by Ken Dritz]


Page 750:
On the second line following the procedure declarations in Section 16.4.1.1, change "When a textual input file is opened or reset" to "When a textual output file is opened or reset".

[Reported by Ken Dritz]


Page 776:
In the first sentence of the first full paragraph on the page, "the versions obtaining input from a string" should read, "the versions writing output to a string."

Page 776:
In the first full paragraph on the page, replace the third sentence--
Numeric literals are always placed at the right end of the string, preceded by zero or more spaces, and enumeration literals and complex-number aggregates are always placed at the left end of the string, followed by zero or more spaces.
--with the following:
Numeric literals are always placed at the right end of the string, preceded by zero or more spaces, and enumeration literals are always placed at the left end of the string, followed by zero or more spaces. Complex-number aggregates are formatted with the parentheses at the two ends of the string and zero or more spaces inserted after the comma.

[Reported by Ken Dritz]


Page 787:
On the fifth line of the first full paragraph, change "mod 255" to "mod 256".

[Reported by Ken Dritz]


Pages 791-792:
The package Binary_Trees would work correctly if the three statements
   Integer'Write (Stream, Tree.Value_Part);
   Write_Tree (Stream, Tree.Left_Subtree_Part);
   Write_Tree (Stream, Tree.Right_Subtree_Part);
in the else part in Write_Tree were replaced with
   Node_Type'Write(Stream, Tree.all);
and the three statements
   Integer'Read (Stream, Tree.Value_Part);
   Read_Tree (Stream, Tree.Left_Subtree_Part);
   Read_Tree (Stream, Tree.Right_Subtree_Part);
in the then part in Read_Tree were replaced with

   Node_Type'Read(Stream, Tree.all);
(With this change, the components of a Tree_Node record would be written and read in the order Left_Subtree_Part, Value_Part, Right_Subtree_Part rather than Value_Part, Left_Subtree_Part, Right_Subtree_Part, but Write_Tree and Read_Tree would remain consistent with each other.)

[Reported by David C. Hoos, Sr.]


Page 793:
On the ninth line from the bottom of the page, change "input is written" to "output is written".

[Reported by Ken Dritz]


Page 794 (fixed in second printing):
In July 1997, the ISO working group responsible for maintaining the Ada standard approved a binding interpretation of the standard (AI95-00001) stating that Stream raises IO_Exceptions.Status_Error when called with a closed file. (The original Ada-95 standard left this unspecified.) The binding interpretation has not yet received final approval from the full ISO working group, but rewriting the program Sum_Groups as follows avoids the issue entirely:
   with Ada.Float_Text_IO, Ada.Streams.Stream_IO;
   use Ada.Float_Text_IO, Ada.Streams.Stream_IO;
   procedure Sum_Groups is

      Input_File   : File_Type;
      Input_Stream : Stream_Access;
      Group_Size   : Integer;
      Sum          : Float;
      Next         : Float;
   begin
      Open (Input_File, In_File, "mixed.data");
      Input_Stream := Stream(Input_File);
      while not End_Of_File(Input_File) loop
         Integer'Read (Input_Stream, Group_Size);
         Sum := 0.0;
         for I in 1 .. Group_Size loop

            Float'Read (Input_Stream, Next);
            Sum := Sum + Next;
         end loop;
         Put (Sum);
      end loop;
      Close (Input_File);
   end Sum_Groups;
(The only change is to move the call on Stream from the declaration of Input_Stream to just after the call on Open.)

[Reported by Brian Rogoff]


Page 797:
Delete the word "files" from the last bullet.

[Reported by Ken Dritz]


Page 805 (fixed in second printing):
In Exercise 16.8, in the description of the output file, the line
Columns 60-64: Average grade (in the form 99.99)
should read:
Columns 60-65: Average grade (in the form 999.99)
(thus allowing for an average grade of 100.00).

Chapter 17. Introduction to Tasks


Page 812:
In the Line_Stream_Type task body, the call on Put_Line should read
   Put_Line (File, Line);

[Reported by Jean-Etienne Doucet]


Page 816:
On the third line of the second paragraph of Section 17.3, after the words "A task object cannot cease to exist", insert "(except perhaps as the result of unchecked deallocation)". On the seventh line of the paragraph, following the words "when an object ceases to exist", add the words "because of departure from some construct". See also the errata on pages 818 and 924.

[Reported by Ken Dritz]


Page 817:
In the comments in procedure P, change all occurrences of "Inner_" to "Outer_" and vice versa, so that P's sequence of statements reads as follows:
   ...
   declare
      Inner_Task_Object : Task_Type;
      Inner_Task_List   : Task_List_Type;
      Task_Pointer      : Task_Pointer_Type;
      Task_List_Pointer : Task_List_Pointer_Type;
   begin
      ...
      Task_Pointer := new Task_Type;  -- A new task begins execution.
      Task_List_Pointer := new Task_List_Type;
                           --  Three new tasks begin execution.
      ...
      -- Wait for Inner_Task_Object, Inner_Task_List(1),
      --    Inner_Task_List(2), and Inner_Task_List(3) to terminate
      --    before leaving block statement.
   end;
   ...
   -- Wait for Outer_Task_Object, Outer_Task_List(1),
   --    Outer_Task_List(2), Outer_Task_List(3), and the four tasks
   --    created by allocators to terminate before returning.

[Reported by Ken Dritz]


Page 818:
Add the following paragraph at the end of Section 17.3:
(Depending on the Ada implementation--i.e., the compiler and the run-time system that the compiler invokes--a task object may cease to exist not only because of departure from some construct, but also because of unchecked deallocation, of either the task object itself or some object containing the task object. Some implementations allow such deallocation even while the corresponding task is still executing, provided that the task object does not have discriminants. The task continues its execution as normal, but no other task can refer to it. Unchecked deallocation of a task object with discriminants is an error if the corresponding task is still executing, because that task may still refer to the discriminants of the task object.)
See also the erratum on page 924.

[Reported by Ken Dritz]


Page 829:
On the second line, change the second occurrence of "named" to "name".

[Reported by Ken Dritz]


Page 847:
The last line should read
                        .....................
   task type identifier : discriminant-part : is
                        :...................:

[Reported by Ken Dritz]


Page 848:
In the typical form of a task body (about halfway down the page), the first line should read
   task body identifier is

[Reported by Ken Dritz]


Chapter 18. Controlling Task Interaction


Page 860:
In the last line of the second full paragraph, change "Put" to "New_Line".

[Reported by Ken Dritz]


Page 861:
In the File_Queue task body, change the value of Capacity from 16 to 8 (in accordance with the third line of Section 18.1.1.2), change the upper bound of Length from Capacity-1 to Capacity, and change the statements
   Front := Front + 1;  -- mod Capacity
   Length := Length + 1;

in the select alternative for Dequeue to
   Front := Front + 1;  -- mod Capacity
   Length := Length - 1;
(Note: This change is in the second select alternative. The identical assignment to Length in the first select alternative is correct.)

[Reported by Ken Dritz]


Pages 879-880:
In the body of the protected procedure Set_Load, replace the statement
   Retrying := True;
with
   if Wait_To_Retry'Count > 0 then
      Retrying := True;
   end if;

In the paragraph beginning four lines below the Load_Manager protected body, replace the first sentence with, "The bodies of the Set_Load procedure and the Wait_To_Retry entry use the 'Count attribute." Replace the last sentence of the paragraph with, "The 'Count attribute can be used in a barrier."

On the fourth line from the bottom of page 879, replace "When Set_Load is called" with "When calls are queued on Wait_To_Retry and Set_Load is called".

On the third line of page 880, insert the following sentence before the word "Because":

(The if statement in Set_Load ensures that the barrier of Wait_Until_Load_Less_Than does not get closed in the first place unless there is at least one call queued on Wait_To_Retry, so that the last such call can reopen the barrier.)

[Reported by Matthew Heany]


Page 880:
On the fourth line, change "Wait_- Until_Load_Less_Than" to "Wait_Until_Load_Less_Than".

Page 903:
On line 13 of the second paragraph, change "299-year range" to "199-year range".

[Reported by Howard W. Ludwig]


Page 924:
Insert the following paragraph at the end of Section 18.9.2:
As explained in Section 17.3, it is an error to attempt the unchecked deallocation of a task object with discriminants while its task is still active. Some implementations may respond to this error by ignoring the attempted deallocation, some may respond by raising an exception, and some may respond by performing the deallocation, but raising an exception inside the active task when it attempts to refer to one of its discriminants. The exception raised may be either Tasking_Error or Program_Error, regardless of whether the exception was raised upon the attempt to deallocate or the attempt to refer to a discriminant.
(The reference to Section 17.3 assumes that the correction to page 818 has been incorporated.)

Page 940:
In Exercise 18.8, the declaration of package Heating_Equipment should include the following procedure declaration:
   procedure Set_Heater (Setting: in Heater_Setting_Type);

Chapter 19. Low-Level and Multilingual Programming


Page 953:
On the third and fourth lines, change "type" to "subtype", so that the affected sentence reads as follows:
If X is an object of a scalar subtype, the attribute X'Valid yields the value True if X holds a valid value of that subtype and False otherwise; evaluation of the attribute itself never causes an error.

Page 963:
Replace the beginning of the first paragraph, preceding the word "Unlike", with the following:
Another pragma, Optimize, is similar in purpose to the Pack pragma. It takes one of three forms:
pragma Optimize (Space);
pragma Optimize (Time);
pragma Optimize (Off);
The first form advises the compiler to generate code that minimizes storage requirements, even at the cost of making the program run more slowly. The second form advises the compiler to generate fast code, even if it requires more storage. The third form advises the compiler not to optimize the code that it generates.
(See also the erratum on page 998.)

[Reported by David Naiditch]


Page 998:
At the end of Section 19.8, add "The argument Off is not allowed for the Optimize pragma in Ada 83." (See also the erratum on page 963.)

Page 1006:
Replace the second sentence of Exercise 19.4 with the following:
The text-mode video buffer is an array of values belonging to a type Display_Element_Type. A Display_Element_Type value consists of the character to be displayed followed by a byte indicating the color to be used in the foreground and the color to be used in the background.
Before the words "The eight possible combinations," insert the following sentence:
These bit numbers are all little-endian.

Chapter 20. Distributed Programs


Page 1011:
In the second line before the last paragraph on the page, Communications_Error should be Communication_Error.

[Reported by Rob Pettit]


Page 1018:
In the penultimate line of the first paragraph, Communications_Error should be Communication_Error.

[Reported by Rob Pettit]


Page 1020:
Change the first two declarations in the private part of package Text from
   type Text_Type is access String;
   type Text_List_Type is access Text_Array_Type;

to
   type Text_Type is access all String;
   type Text_List_Type is access all Text_Array_Type;

Page 1034:
Each of the exercises should refer to Section 20.2.2.3 rather than to Section 20.2.2.2. (Also, see the erratum on page 1020 before attempting Exercise 20.2.)

Appendix A. Scope and Visibility

(There are no known errata in Appendix A.)

Appendix B. Accuracy of Fixed-Point and Floating-Point Arithmetic

(There are no known errata in Appendix B.)

Appendix C. The Specialized-Needs Annexes


Page 1052:
In the "Feature" column of the first table entry in Section C.4, change "10.0E-18" to "1.0E-18".

[Reported by Howard W. Ludwig]


Appendix D. Predefined Library Units and the Pragmas Applied to Them

(There are no known errata in Appendix D.)

Appendix E. The Latin-1 Character Set

(There are no known errata in Appendix E.)

Index


Page 1069:
In the index entry for
accept statement
the list of pages should be 37, 837-841, 846.

[Reported by Ken Dritz]


Page 1078:
In the index entry for
Character
mapping from to another character
the list of pages should be 198-199, 200-201, 201-202.

[Reported by Ken Dritz]


Page 1085:
The index term
Discriminant
not allowed as an in or in out actual parameter
should read:
Discriminant
not allowed as an in out or out actual parameter
[Reported by Ken Dritz]

Page 1094:
In the index entry for
Get (input procedure)
for decimal fixed-point types
the list of pages should be 127, 754-756, 765-766, 795.

[Reported by Ken Dritz]


Page 1098:
In the index entry for
Input and output
for a signed integer type
the list of pages should be 754-756, 756-760.

[Reported by Ken Dritz]


Page 1098:
In the index entry for
Integer type
signed
input and output for
the list of pages should be 754-756, 756-760.

[Reported by Ken Dritz]


Page 1108:
In the index entry for
Package body
the list of pages should be 21-23, 406-407, 407-410.

[Reported by Ken Dritz]


Page 1132:
In the index entry for
Variant part
the list of pages should be 374-375, 375-379.

[Reported by Ken Dritz]


[ Pages 1-100 | 101-200 | 201-300 | 301-400 | 401-500 | 501-600 | 601-700 | 701-800 | 801-900 | 901-1000 | 1001-1100 | 1101-1133 ]

[Chapters 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 ]
[Appendices A | B | C | D | E ]
[Index]