Information technology — Programming languages — Ada

This document specifies the form and meaning of programs written in Ada. Its purpose is to promote the portability of Ada programs to a variety of computing systems. This document specifies: — The form of a program written in Ada; — The effect of translating and executing such a program; — The manner in which program units can be combined to form Ada programs; — The language-defined library units that a conforming implementation is required to supply; — The permissible variations in conformance to the rules of this document, and the manner in which they are to be documented; — Those violations of the requirements of this document that a conforming implementation is required to detect, and the effect of attempting to translate or execute a program containing such violations; — Those violations of the requirements of this document that a conforming implementation is not required to detect. This document does not specify: — The means whereby a program written in Ada is transformed into object code executable by a processor; — The means whereby translation or execution of programs is invoked and the executing units are controlled; — The size or speed of the object code, or the relative execution speed of different language constructs; — The form or contents of any listings produced by implementations; in particular, the form or contents of error or warning messages; — The effect of unspecified execution; — The size of a program or program unit that will exceed the capacity of a particular conforming implementation.

Technologies de l'information — Langages de programmation — Ada

[Not translated]

General Information

Status
Published
Publication Date
01-May-2023
Current Stage
9092 - International Standard to be revised
Start Date
09-Sep-2025
Completion Date
30-Oct-2025

Relations

Standard
ISO/IEC 8652:2023 - Information technology — Programming languages — Ada Released:2. 05. 2023
English language
1048 pages
sale 15% off
Preview
sale 15% off
Preview

Standards Content (Sample)


INTERNATIONAL ISO/IEC
STANDARD 8652
Fourth edition
2023-05
Information technology —
Programming languages — Ada
Technologies de l'information — Langages de programmation — Ada
Reference number
© ISO/IEC 2023
© ISO/IEC 2023
All rights reserved. Unless otherwise specified, or required in the context of its implementation, no part of this publication may
be reproduced or utilized otherwise in any form or by any means, electronic or mechanical, including photocopying, or posting on
the internet or an intranet, without prior written permission. Permission can be requested from either ISO at the address below
or ISO’s member body in the country of the requester.
ISO copyright office
CP 401 • Ch. de Blandonnet 8
CH-1214 Vernier, Geneva
Phone: +41 22 749 01 11
Email: copyright@iso.org
Website: www.iso.org
Published in Switzerland
ii
© ISO/IEC 2023 – All rights reserved

Contents
Foreword . xiii
Introduction . xv
1 Scope . 1
2 Normative references . 1
3 Terms and definitions . 2
3.1 Types, objects, and their properties . 2
3.2 Subprograms and their properties . 7
3.3 Other syntactic constructs . 7
3.4 Runtime actions . 10
3.5 Exceptional situations . 10
4 General . 11
4.1 Structure . 11
4.2 Conformity of an Implementation . 12
4.3 Method of Description and Syntax Notation . 14
4.4 Classification of Errors . 15
5 Lexical Elements . 16
5.1 Character Set . 16
5.2 Lexical Elements, Separators, and Delimiters . 18
5.3 Identifiers . 19
5.4 Numeric Literals . 20
5.4.1 Decimal Literals . 20
5.4.2 Based Literals . 21
5.5 Character Literals . 21
5.6 String Literals . 21
5.7 Comments . 22
5.8 Pragmas . 22
5.9 Reserved Words . 25
6 Declarations and Types . 25
6.1 Declarations . 25
6.2 Types and Subtypes . 27
6.2.1 Type Declarations. 28
6.2.2 Subtype Declarations . 29
6.2.3 Classification of Operations . 30
6.2.4 Subtype Predicates . 31
6.3 Objects and Named Numbers . 34
6.3.1 Object Declarations . 36
6.3.2 Number Declarations . 39
6.4 Derived Types and Classes . 39
6.4.1 Derivation Classes . 42
6.5 Scalar Types . 44
6.5.1 Enumeration Types . 47
6.5.2 Character Types . 48
6.5.3 Boolean Types . 49
6.5.4 Integer Types . 49
6.5.5 Operations of Discrete Types . 52
6.5.6 Real Types . 53
6.5.7 Floating Point Types . 54
© ISO/IEC 2023 – All rights reserved iii

6.5.8 Operations of Floating Point Types . 55
6.5.9 Fixed Point Types . 56
6.5.10 Operations of Fixed Point Types . 58
6.6 Array Types . 59
6.6.1 Index Constraints and Discrete Ranges . 61
6.6.2 Operations of Array Types . 62
6.6.3 String Types . 63
6.7 Discriminants . 63
6.7.1 Discriminant Constraints . 66
6.7.2 Operations of Discriminated Types . 67
6.8 Record Types . 67
6.8.1 Variant Parts and Discrete Choices . 70
6.9 Tagged Types and Type Extensions . 72
6.9.1 Type Extensions . 75
6.9.2 Dispatching Operations of Tagged Types . 76
6.9.3 Abstract Types and Subprograms . 79
6.9.4 Interface Types . 80
6.10 Access Types . 82
6.10.1 Incomplete Type Declarations . 85
6.10.2 Operations of Access Types . 87
6.11 Declarative Parts . 93
6.11.1 Completions of Declarations . 93
7 Names and Expressions . 94
7.1 Names . 94
7.1.1 Indexed Components . 95
7.1.2 Slices . 96
7.1.3 Selected Components . 97
7.1.4 Attributes . 99
7.1.5 User-Defined References . 100
7.1.6 User-Defined Indexing . 101
7.2 Literals . 103
7.2.1 User-Defined Literals . 104
7.3 Aggregates . 106
7.3.1 Record Aggregates . 106
7.3.2 Extension Aggregates . 108
7.3.3 Array Aggregates . 110
7.3.4 Delta Aggregates . 114
7.3.5 Container Aggregates . 115
7.4 Expressions . 121
7.5 Operators and Expression Evaluation . 123
7.5.1 Logical Operators and Short-circuit Control Forms . 124
7.5.2 Relational Operators and Membership Tests . 125
7.5.3 Binary Adding Operators . 128
7.5.4 Unary Adding Operators . 129
7.5.5 Multiplying Operators . 129
7.5.6 Highest Precedence Operators . 132
7.5.7 Conditional Expressions . 132
7.5.8 Quantified Expressions . 134
7.5.9 Declare Expressions . 135
7.5.10 Reduction Expressions . 136
7.6 Type Conversions. 139
7.7 Qualified Expressions . 144
7.8 Allocators . 144
7.9 Static Expressions and Static Subtypes . 146
7.9.1 Statically Matching Constraints and Subtypes . 150
iv © ISO/IEC 2023 – All rights reserved

7.10 Image Attributes . 151
8 Statements . 154
8.1 Simple and Compound Statements - Sequences of Statements . 155
8.2 Assignment Statements . 156
8.2.1 Target Name Symbols. 158
8.3 If Statements . 158
8.4 Case Statements . 159
8.5 Loop Statements . 160
8.5.1 User-Defined Iterator Types . 164
8.5.2 Generalized Loop Iteration . 166
8.5.3 Procedural Iterators . 169
8.6 Block Statements . 172
8.6.1 Parallel Block Statements . 172
8.7 Exit Statements . 174
8.8 Goto Statements . 175
9 Subprograms . 175
9.1 Subprogram Declarations . 176
9.1.1 Preconditions and Postconditions . 178
9.1.2 The Global and Global'Class Aspects. 183
9.2 Formal Parameter Modes . 186
9.3 Subprogram Bodies . 187
9.3.1 Conformance Rules . 188
9.3.2 Inline Expansion of Subprograms. 190
9.4 Subprogram Calls . 190
9.4.1 Parameter Associations . 192
9.5 Return Statements . 194
9.5.1 Nonreturning Subprograms. 197
9.6 Overloading of Operators . 198
9.7 Null Procedures . 199
9.8 Expression Functions . 199
10 Packages . 201
10.1 Package Specifications and Declarations . 201
10.2 Package Bodies . 202
10.3 Private Types and Private Extensions . 203
10.3.1 Private Operations . 205
10.3.2 Type Invariants . 208
10.3.3 Default Initial Conditions . 211
10.3.4 Stable Properties of a Type . 211
10.4 Deferred Constants . 213
10.5 Limited Types . 214
10.6 Assignment and Finalization . 216
10.6.1 Completion and Finalization . 219
11 Visibility Rules . 221
11.1 Declarative Region . 221
11.2 Scope of Declarations . 222
11.3 Visibility . 223
11.3.1 Overriding Indicators. 226
11.4 Use Clauses. 227
11.5 Renaming Declarations . 228
11.5.1 Object Renaming Declarations . 228
11.5.2 Exception Renaming Declarations . 230
11.5.3 Package Renaming Declarations . 230
11.5.4 Subprogram Renaming Declarations . 230
© ISO/IEC 2023 – All rights reserved v

11.5.5 Generic Renaming Declarations . 232
11.6 The Context of Overload Resolution . 233
12 Tasks and Synchronization . 235
12.1 Task Units and Task Objects . 236
12.2 Task Execution - Task Activation . 238
12.3 Task Dependence - Termination of Tasks . 239
12.4 Protected Units and Protected Objects . 241
12.5 Intertask Communication . 244
12.5.1 Protected Subprograms and Protected Actions . 248
12.5.2 Entries and Accept Statements. 250
12.5.3 Entry Calls . 253
12.5.4 Requeue Statements . 255
12.6 Delay Statements, Duration, and Time . 257
12.6.1 Formatting, Time Zones, and other operations for Time . 260
12.7 Select Statements . 266
12.7.1 Selective Accept . 266
12.7.2 Timed Entry Calls . 268
12.7.3 Conditional Entry Calls . 269
12.7.4 Asynchronous Transfer of Control. 269
12.8 Abort of a Task - Abort of a Sequence of Statements . 270
12.9 Task and Entry Attributes . 272
12.10 Shared Variables . 272
12.10.1 Conflict Check Policies . 274
12.11 Example of Tasking and Synchronization . 276
13 Program Structure and Compilation Issues . 277
13.1 Separate Compilation . 277
13.1.1 Compilation Units - Library Units . 278
13.1.2 Context Clauses - With Clauses . 281
13.1.3 Subunits of Compilation Units . 283
13.1.4 The Compilation Process . 284
13.1.5 Pragmas and Program Units . 285
13.1.6 Environment-Level Visibility Rules . 286
13.2 Program Execution . 286
13.2.1 Elaboration Control . 288
14 Exceptions . 291
14.1 Exception Declarations . 292
14.2 Exception Handlers . 292
14.3 Raise Statements and Raise Expressions . 293
14.4 Exception Handling . 294
14.4.1 The Package Exceptions. 295
14.4.2 Pragmas Assert and Assertion_Policy . 297
14.4.3 Example of Exception Handling . 299
14.5 Suppressing Checks . 300
14.6 Exceptions and Optimization . 303
15 Generic Units . 304
15.1 Generic Declarations . 304
15.2 Generic Bodies . 306
15.3 Generic Instantiation . 307
15.4 Formal Objects . 309
15.5 Formal Types . 310
15.5.1 Formal Private and Derived Types . 312
15.5.2 Formal Scalar Types . 314
15.5.3 Formal Array Types . 314
vi © ISO/IEC 2023 – All rights reserved

15.5.4 Formal Access Types . 315
15.5.5 Formal Interface Types . 316
15.6 Formal Subprograms . 316
15.7 Formal Packages . 319
15.8 Example of a Generic Package . 321
16 Representation Issues . 322
16.1 Operational and Representation Aspects. 322
16.1.1 Aspect Specifications . 326
16.2 Packed Types . 329
16.3 Operational and Representation Attributes . 330
16.4 Enumeration Representation Clauses . 337
16.5 Record Layout . 338
16.5.1 Record Representation Clauses . 338
16.5.2 Storage Place Attributes . 341
16.5.3 Bit Ordering . 341
16.6 Change of Representation . 342
16.7 The Package System . 342
16.7.1 The Package System.Storage_Elements . 344
16.7.2 The Package System.Address_To_Access_Conversions . 345
16.8 Machine Code Insertions . 346
16.9 Unchecked Type Conversions . 347
16.9.1 Data Validity . 348
16.9.2 The Valid Attribute . 349
16.10 Unchecked Access Value Creation. 349
16.11 Storage Management . 350
16.11.1 Storage Allocation Attributes . 353
16.11.2 Unchecked Storage Deallocation . 354
16.11.3 Default Storage Pools . 355
16.11.4 Storage Subpools . 356
16.11.5 Subpool Reclamation . 359
16.11.6 Storage Subpool Example . 359
16.12 Pragma Restrictions and Pragma Profile . 362
16.12.1 Language-Defined Restrictions and Profiles . 363
16.13 Streams . 365
16.13.1 The Streams Subsystem . 365
16.13.2 Stream-Oriented Attributes . 368
16.14 Freezing Rules . 373
Annex A (normative) Predefined Language Environment . 376
A.1 The Package Standard . 379
A.2 The Package Ada . 384
A.3 Character Handling . 384
A.3.1 The Packages Characters, Wide_Characters, and Wide_Wide_Characters . 384
A.3.2 The Package Characters.Handling . 385
A.3.3 The Package Characters.Latin_1. 387
A.3.4 The Package Characters.Conversions . 395
A.3.5 The Package Wide_Characters.Handling . 397
A.3.6 The Package Wide_Wide_Characters.Handling . 400
A.4 String Handling . 400
A.4.1 The Package Strings . 400
A.4.2 The Package Strings.Maps . 401
A.4.3 Fixed-Length String Handling . 404
A.4.4 Bounded-Length String Handling . 412
A.4.5 Unbounded-Length String Handling . 419
A.4.6 String-Handling Sets and Mappings . 425
© ISO/IEC 2023 – All rights reserved vii

A.4.7 Wide_String Handling . 425
A.4.8 Wide_Wide_String Handling . 428
A.4.9 String Hashing . 430
A.4.10 String Comparison . 431
A.4.11 String Encoding . 432
A.4.12 Universal Text Buffers . 437
A.5 The Numerics Packages . 439
A.5.1 Elementary Functions . 440
A.5.2 Random Number Generation . 443
A.5.3 Attributes of Floating Point Types . 448
A.5.4 Attributes of Fixed Point Types . 452
A.5.5 Big Numbers . 453
A.5.6 Big Integers . 453
A.5.7 Big Reals . 455
A.6 Input-Output . 457
A.7 External Files and File Objects . 457
A.8 Sequential and Direct Files . 458
A.8.1 The Generic Package Sequential_IO . 459
A.8.2 File Management . 460
A.8.3 Sequential Input-Output Operations . 462
A.8.4 The Generic Package Direct_IO . 463
A.8.5 Direct Input-Output Operations . 464
A.9 The Generic Package Storage_IO . 465
A.10 Text Input-Output . 466
A.10.1 The Package Text_IO . 467
A.10.2 Text File Management . 475
A.10.3 Default Input, Output, and Error Files . 475
A.10.4 Specification of Line and Page Lengths . 476
A.10.5 Operations on Columns, Lines, and Pages . 477
A.10.6 Get and Put Procedures . 480
A.10.7 Input-Output of Characters and Strings . 481
A.10.8 Input-Output for Integer Types . 483
A.10.9 Input-Output for Real Types . 485
A.10.10 Input-Output for Enumeration Types . 487
A.10.11 Input-Output for Bounded Strings. 488
A.10.12 Input-Output for Unbounded Strings . 489
A.11 Wide Text Input-Output and Wide Wide Text Input-Output . 491
A.12 Stream Input-Output . 491
A.12.1 The Package Streams.Stream_IO . 491
A.12.2 The Package Text_IO.Text_Streams . 494
A.12.3 The Package Wide_Text_IO.Text_Streams . 495
A.12.4 The Package Wide_Wide_Text_IO.Text_Streams . 495
A.13 Exceptions in Input-Output. 495
A.14 File Sharing . 497
A.15 The Package Command_Line . 497
A.15.1 The Packages Wide_Command_Line and Wide_Wide_Command_Line . 498
A.16 The Package Directories . 498
A.16.1 The Package Directories.Hierarchical_File_Names . 506
A.16.2 The Packages Wide_Directories and Wide_Wide_Directories . 507
A.17 The Package Environment_Variables . 507
A.17.1 The Packages Wide_Environment_Variables and
Wide_Wide_Environment_Variables . 509
A.18 Containers . 509
A.18.1 The Package Containers . 511
A.18.2 The Generic Package Containers.Vectors . 511
viii © ISO/IEC 2023 – All rights reserved

A.18.3 The Generic Package Containers.Doubly_Linked_Lists . 545
A.18.4 Maps. 567
A.18.5 The Generic Package Containers.Hashed_Maps . 577
A.18.6 The Generic Package Containers.Ordered_Maps . 586
A.18.7 Sets . 597
A.18.8 The Generic Package Containers.Hashed_Sets . 608
A.18.9 The Generic Package Containers.Ordered_Sets . 618
A.18.10 The Generic Package Containers.Multiway_Trees .
...

Questions, Comments and Discussion

Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.

Loading comments...