Table of Contents Foreword to this version of the Ada Reference Manual Foreword Introduction 1. General 1.1 Scope 1.1.1 Extent 1.1.2 Structure 1.1.3 Conformity of an Implementation with the Standard 1.1.4 Method of Description and Syntax Notation 1.1.5 Classification of Errors 1.2 Normative References 1.3 Terms and Definitions 2. Lexical Elements 2.1 Character Set 2.2 Lexical Elements, Separators, and Delimiters 2.3 Identifiers 2.4 Numeric Literals 2.4.1 Decimal Literals 2.4.2 Based Literals 2.5 Character Literals 2.6 String Literals 2.7 Comments 2.8 Pragmas 2.9 Reserved Words 3. Declarations and Types 3.1 Declarations 3.2 Types and Subtypes 3.2.1 Type Declarations 3.2.2 Subtype Declarations 3.2.3 Classification of Operations 3.2.4 Subtype Predicates 3.3 Objects and Named Numbers 3.3.1 Object Declarations 3.3.2 Number Declarations 3.4 Derived Types and Classes 3.4.1 Derivation Classes 3.5 Scalar Types 3.5.1 Enumeration Types 3.5.2 Character Types 3.5.3 Boolean Types 3.5.4 Integer Types 3.5.5 Operations of Discrete Types 3.5.6 Real Types 3.5.7 Floating Point Types 3.5.8 Operations of Floating Point Types 3.5.9 Fixed Point Types 3.5.10 Operations of Fixed Point Types 3.6 Array Types 3.6.1 Index Constraints and Discrete Ranges 3.6.2 Operations of Array Types 3.6.3 String Types 3.7 Discriminants 3.7.1 Discriminant Constraints 3.7.2 Operations of Discriminated Types 3.8 Record Types 3.8.1 Variant Parts and Discrete Choices 3.9 Tagged Types and Type Extensions 3.9.1 Type Extensions 3.9.2 Dispatching Operations of Tagged Types 3.9.3 Abstract Types and Subprograms 3.9.4 Interface Types 3.10 Access Types 3.10.1 Incomplete Type Declarations 3.10.2 Operations of Access Types 3.11 Declarative Parts 3.11.1 Completions of Declarations 4. Names and Expressions 4.1 Names 4.1.1 Indexed Components 4.1.2 Slices 4.1.3 Selected Components 4.1.4 Attributes 4.1.5 User-Defined References 4.1.6 User-Defined Indexing 4.2 Literals 4.3 Aggregates 4.3.1 Record Aggregates 4.3.2 Extension Aggregates 4.3.3 Array Aggregates 4.4 Expressions 4.5 Operators and Expression Evaluation 4.5.1 Logical Operators and Short-circuit Control Forms 4.5.2 Relational Operators and Membership Tests 4.5.3 Binary Adding Operators 4.5.4 Unary Adding Operators 4.5.5 Multiplying Operators 4.5.6 Highest Precedence Operators 4.5.7 Conditional Expressions 4.5.8 Quantified Expressions 4.6 Type Conversions 4.7 Qualified Expressions 4.8 Allocators 4.9 Static Expressions and Static Subtypes 4.9.1 Statically Matching Constraints and Subtypes 5. Statements 5.1 Simple and Compound Statements - Sequences of Statements 5.2 Assignment Statements 5.3 If Statements 5.4 Case Statements 5.5 Loop Statements 5.5.1 User-Defined Iterator Types 5.5.2 Generalized Loop Iteration 5.6 Block Statements 5.7 Exit Statements 5.8 Goto Statements 6. Subprograms 6.1 Subprogram Declarations 6.1.1 Preconditions and Postconditions 6.2 Formal Parameter Modes 6.3 Subprogram Bodies 6.3.1 Conformance Rules 6.3.2 Inline Expansion of Subprograms 6.4 Subprogram Calls 6.4.1 Parameter Associations 6.5 Return Statements 6.5.1 Nonreturning Procedures 6.6 Overloading of Operators 6.7 Null Procedures 6.8 Expression Functions 7. Packages 7.1 Package Specifications and Declarations 7.2 Package Bodies 7.3 Private Types and Private Extensions 7.3.1 Private Operations 7.3.2 Type Invariants 7.4 Deferred Constants 7.5 Limited Types 7.6 Assignment and Finalization 7.6.1 Completion and Finalization 8. Visibility Rules 8.1 Declarative Region 8.2 Scope of Declarations 8.3 Visibility 8.3.1 Overriding Indicators 8.4 Use Clauses 8.5 Renaming Declarations 8.5.1 Object Renaming Declarations 8.5.2 Exception Renaming Declarations 8.5.3 Package Renaming Declarations 8.5.4 Subprogram Renaming Declarations 8.5.5 Generic Renaming Declarations 8.6 The Context of Overload Resolution 9. Tasks and Synchronization 9.1 Task Units and Task Objects 9.2 Task Execution - Task Activation 9.3 Task Dependence - Termination of Tasks 9.4 Protected Units and Protected Objects 9.5 Intertask Communication 9.5.1 Protected Subprograms and Protected Actions 9.5.2 Entries and Accept Statements 9.5.3 Entry Calls 9.5.4 Requeue Statements 9.6 Delay Statements, Duration, and Time 9.6.1 Formatting, Time Zones, and other operations for Time 9.7 Select Statements 9.7.1 Selective Accept 9.7.2 Timed Entry Calls 9.7.3 Conditional Entry Calls 9.7.4 Asynchronous Transfer of Control 9.8 Abort of a Task - Abort of a Sequence of Statements 9.9 Task and Entry Attributes 9.10 Shared Variables 9.11 Example of Tasking and Synchronization 10. Program Structure and Compilation Issues 10.1 Separate Compilation 10.1.1 Compilation Units - Library Units 10.1.2 Context Clauses - With Clauses 10.1.3 Subunits of Compilation Units 10.1.4 The Compilation Process 10.1.5 Pragmas and Program Units 10.1.6 Environment-Level Visibility Rules 10.2 Program Execution 10.2.1 Elaboration Control 11. Exceptions 11.1 Exception Declarations 11.2 Exception Handlers 11.3 Raise Statements and Raise Expressions 11.4 Exception Handling 11.4.1 The Package Exceptions 11.4.2 Pragmas Assert and Assertion_Policy 11.4.3 Example of Exception Handling 11.5 Suppressing Checks 11.6 Exceptions and Optimization 12. Generic Units 12.1 Generic Declarations 12.2 Generic Bodies 12.3 Generic Instantiation 12.4 Formal Objects 12.5 Formal Types 12.5.1 Formal Private and Derived Types 12.5.2 Formal Scalar Types 12.5.3 Formal Array Types 12.5.4 Formal Access Types 12.5.5 Formal Interface Types 12.6 Formal Subprograms 12.7 Formal Packages 12.8 Example of a Generic Package 13. Representation Issues 13.1 Operational and Representation Aspects 13.1.1 Aspect Specifications 13.2 Packed Types 13.3 Operational and Representation Attributes 13.4 Enumeration Representation Clauses 13.5 Record Layout 13.5.1 Record Representation Clauses 13.5.2 Storage Place Attributes 13.5.3 Bit Ordering 13.6 Change of Representation 13.7 The Package System 13.7.1 The Package System.Storage_Elements 13.7.2 The Package System.Address_To_Access_Conversions 13.8 Machine Code Insertions 13.9 Unchecked Type Conversions 13.9.1 Data Validity 13.9.2 The Valid Attribute 13.10 Unchecked Access Value Creation 13.11 Storage Management 13.11.1 Storage Allocation Attributes 13.11.2 Unchecked Storage Deallocation 13.11.3 Default Storage Pools 13.11.4 Storage Subpools 13.11.5 Subpool Reclamation 13.11.6 Storage Subpool Example 13.12 Pragma Restrictions and Pragma Profile 13.12.1 Language-Defined Restrictions and Profiles 13.13 Streams 13.13.1 The Package Streams 13.13.2 Stream-Oriented Attributes 13.14 Freezing Rules The Standard Libraries A. Predefined Language Environment A.1 The Package Standard A.2 The Package Ada A.3 Character Handling A.3.1 The Packages Characters, Wide_Characters, and Wide_Wide_Characters A.3.2 The Package Characters.Handling A.3.3 The Package Characters.Latin_1 A.3.4 The Package Characters.Conversions A.3.5 The Package Wide_Characters.Handling A.3.6 The Package Wide_Wide_Characters.Handling A.4 String Handling A.4.1 The Package Strings A.4.2 The Package Strings.Maps A.4.3 Fixed-Length String Handling A.4.4 Bounded-Length String Handling A.4.5 Unbounded-Length String Handling A.4.6 String-Handling Sets and Mappings A.4.7 Wide_String Handling A.4.8 Wide_Wide_String Handling A.4.9 String Hashing A.4.10 String Comparison A.4.11 String Encoding A.5 The Numerics Packages A.5.1 Elementary Functions A.5.2 Random Number Generation A.5.3 Attributes of Floating Point Types A.5.4 Attributes of Fixed Point Types A.6 Input-Output A.7 External Files and File Objects A.8 Sequential and Direct Files A.8.1 The Generic Package Sequential_IO A.8.2 File Management A.8.3 Sequential Input-Output Operations A.8.4 The Generic Package Direct_IO A.8.5 Direct Input-Output Operations A.9 The Generic Package Storage_IO A.10 Text Input-Output A.10.1 The Package Text_IO A.10.2 Text File Management A.10.3 Default Input, Output, and Error Files A.10.4 Specification of Line and Page Lengths A.10.5 Operations on Columns, Lines, and Pages A.10.6 Get and Put Procedures A.10.7 Input-Output of Characters and Strings A.10.8 Input-Output for Integer Types A.10.9 Input-Output for Real Types A.10.10 Input-Output for Enumeration Types A.10.11 Input-Output for Bounded Strings A.10.12 Input-Output for Unbounded Strings A.11 Wide Text Input-Output and Wide Wide Text Input-Output A.12 Stream Input-Output A.12.1 The Package Streams.Stream_IO A.12.2 The Package Text_IO.Text_Streams A.12.3 The Package Wide_Text_IO.Text_Streams A.12.4 The Package Wide_Wide_Text_IO.Text_Streams A.13 Exceptions in Input-Output A.14 File Sharing A.15 The Package Command_Line A.16 The Package Directories A.16.1 The Package Directories.Hierarchical_File_Names A.17 The Package Environment_Variables A.18 Containers A.18.1 The Package Containers A.18.2 The Generic Package Containers.Vectors A.18.3 The Generic Package Containers.Doubly_Linked_Lists A.18.4 Maps A.18.5 The Generic Package Containers.Hashed_Maps A.18.6 The Generic Package Containers.Ordered_Maps A.18.7 Sets A.18.8 The Generic Package Containers.Hashed_Sets A.18.9 The Generic Package Containers.Ordered_Sets A.18.10 The Generic Package Containers.Multiway_Trees A.18.11 The Generic Package Containers.Indefinite_Vectors A.18.12 The Generic Package Containers.Indefinite_Doubly_Linked_Lists A.18.13 The Generic Package Containers.Indefinite_Hashed_Maps A.18.14 The Generic Package Containers.Indefinite_Ordered_Maps A.18.15 The Generic Package Containers.Indefinite_Hashed_Sets A.18.16 The Generic Package Containers.Indefinite_Ordered_Sets A.18.17 The Generic Package Containers.Indefinite_Multiway_Trees A.18.18 The Generic Package Containers.Indefinite_Holders A.18.19 The Generic Package Containers.Bounded_Vectors A.18.20 The Generic Package Containers.Bounded_Doubly_Linked_Lists A.18.21 The Generic Package Containers.Bounded_Hashed_Maps A.18.22 The Generic Package Containers.Bounded_Ordered_Maps A.18.23 The Generic Package Containers.Bounded_Hashed_Sets A.18.24 The Generic Package Containers.Bounded_Ordered_Sets A.18.25 The Generic Package Containers.Bounded_Multiway_Trees A.18.26 Array Sorting A.18.27 The Generic Package Containers.Synchronized_Queue_Interfaces A.18.28 The Generic Package Containers.Unbounded_Synchronized_Queues A.18.29 The Generic Package Containers.Bounded_Synchronized_Queues A.18.30 The Generic Package Containers.Unbounded_Priority_Queues A.18.31 The Generic Package Containers.Bounded_Priority_Queues A.18.32 Example of Container Use A.19 The Package Locales B. Interface to Other Languages B.1 Interfacing Aspects B.2 The Package Interfaces B.3 Interfacing with C and C++ B.3.1 The Package Interfaces.C.Strings B.3.2 The Generic Package Interfaces.C.Pointers B.3.3 Unchecked Union Types B.4 Interfacing with COBOL B.5 Interfacing with Fortran C. Systems Programming C.1 Access to Machine Operations C.2 Required Representation Support C.3 Interrupt Support C.3.1 Protected Procedure Handlers C.3.2 The Package Interrupts C.4 Preelaboration Requirements C.5 Aspect Discard_Names C.6 Shared Variable Control C.7 Task Information C.7.1 The Package Task_Identification C.7.2 The Package Task_Attributes C.7.3 The Package Task_Termination D. Real-Time Systems D.1 Task Priorities D.2 Priority Scheduling D.2.1 The Task Dispatching Model D.2.2 Task Dispatching Pragmas D.2.3 Preemptive Dispatching D.2.4 Non-Preemptive Dispatching D.2.5 Round Robin Dispatching D.2.6 Earliest Deadline First Dispatching D.3 Priority Ceiling Locking D.4 Entry Queuing Policies D.5 Dynamic Priorities D.5.1 Dynamic Priorities for Tasks D.5.2 Dynamic Priorities for Protected Objects D.6 Preemptive Abort D.7 Tasking Restrictions D.8 Monotonic Time D.9 Delay Accuracy D.10 Synchronous Task Control D.10.1 Synchronous Barriers D.11 Asynchronous Task Control D.12 Other Optimizations and Determinism Rules D.13 The Ravenscar Profile D.14 Execution Time D.14.1 Execution Time Timers D.14.2 Group Execution Time Budgets D.14.3 Execution Time of Interrupt Handlers D.15 Timing Events D.16 Multiprocessor Implementation D.16.1 Multiprocessor Dispatching Domains E. Distributed Systems E.1 Partitions E.2 Categorization of Library Units E.2.1 Shared Passive Library Units E.2.2 Remote Types Library Units E.2.3 Remote Call Interface Library Units E.3 Consistency of a Distributed System E.4 Remote Subprogram Calls E.4.1 Asynchronous Remote Calls E.4.2 Example of Use of a Remote Access-to-Class-Wide Type E.5 Partition Communication Subsystem F. Information Systems F.1 Machine_Radix Attribute Definition Clause F.2 The Package Decimal F.3 Edited Output for Decimal Types F.3.1 Picture String Formation F.3.2 Edited Output Generation F.3.3 The Package Text_IO.Editing F.3.4 The Package Wide_Text_IO.Editing F.3.5 The Package Wide_Wide_Text_IO.Editing G. Numerics G.1 Complex Arithmetic G.1.1 Complex Types G.1.2 Complex Elementary Functions G.1.3 Complex Input-Output G.1.4 The Package Wide_Text_IO.Complex_IO G.1.5 The Package Wide_Wide_Text_IO.Complex_IO G.2 Numeric Performance Requirements G.2.1 Model of Floating Point Arithmetic G.2.2 Model-Oriented Attributes of Floating Point Types G.2.3 Model of Fixed Point Arithmetic G.2.4 Accuracy Requirements for the Elementary Functions G.2.5 Performance Requirements for Random Number Generation G.2.6 Accuracy Requirements for Complex Arithmetic G.3 Vector and Matrix Manipulation G.3.1 Real Vectors and Matrices G.3.2 Complex Vectors and Matrices H. High Integrity Systems H.1 Pragma Normalize_Scalars H.2 Documentation of Implementation Decisions H.3 Reviewable Object Code H.3.1 Pragma Reviewable H.3.2 Pragma Inspection_Point H.4 High Integrity Restrictions H.5 Pragma Detect_Blocking H.6 Pragma Partition_Elaboration_Policy J. Obsolescent Features J.1 Renamings of Library Units J.2 Allowed Replacements of Characters J.3 Reduced Accuracy Subtypes J.4 The Constrained Attribute J.5 ASCII J.6 Numeric_Error J.7 At Clauses J.7.1 Interrupt Entries J.8 Mod Clauses J.9 The Storage_Size Attribute J.10 Specific Suppression of Checks J.11 The Class Attribute of Untagged Incomplete Types J.12 Pragma Interface J.13 Dependence Restriction Identifiers J.14 Character and Wide_Character Conversion Functions J.15 Aspect-related Pragmas J.15.1 Pragma Inline J.15.2 Pragma No_Return J.15.3 Pragma Pack J.15.4 Pragma Storage_Size J.15.5 Interfacing Pragmas J.15.6 Pragma Unchecked_Union J.15.7 Pragmas Interrupt_Handler and Attach_Handler J.15.8 Shared Variable Pragmas J.15.9 Pragma CPU J.15.10 Pragma Dispatching_Domain J.15.11 Pragmas Priority and Interrupt_Priority J.15.12 Pragma Relative_Deadline J.15.13 Pragma Asynchronous K. Language-Defined Aspects and Attributes K.1 Language-Defined Aspects K.2 Language-Defined Attributes L. Language-Defined Pragmas M. Summary of Documentation Requirements M.1 Specific Documentation Requirements M.2 Implementation-Defined Characteristics M.3 Implementation Advice N. Glossary P. Syntax Summary Q. Language-Defined Entities Q.1 Language-Defined Packages Q.2 Language-Defined Types and Subtypes Q.3 Language-Defined Subprograms Q.4 Language-Defined Exceptions Q.5 Language-Defined Objects Index