Debian Codegraph @

gcc/ada/doc/gnat_rm/standard_library_routines.rst

raw
1 .. _Standard_Library_Routines:
2
3 *************************
4 Standard Library Routines
5 *************************
6
7 The Ada Reference Manual contains in Annex A a full description of an
8 extensive set of standard library routines that can be used in any Ada
9 program, and which must be provided by all Ada compilers. They are
10 analogous to the standard C library used by C programs.
11
12 GNAT implements all of the facilities described in annex A, and for most
13 purposes the description in the Ada Reference Manual, or appropriate Ada
14 text book, will be sufficient for making use of these facilities.
15
16 In the case of the input-output facilities,
17 :ref:`The_Implementation_of_Standard_I/O`,
18 gives details on exactly how GNAT interfaces to the
19 file system. For the remaining packages, the Ada Reference Manual
20 should be sufficient. The following is a list of the packages included,
21 together with a brief description of the functionality that is provided.
22
23 For completeness, references are included to other predefined library
24 routines defined in other sections of the Ada Reference Manual (these are
25 cross-indexed from Annex A). For further details see the relevant
26 package declarations in the run-time library. In particular, a few units
27 are not implemented, as marked by the presence of pragma Unimplemented_Unit,
28 and in this case the package declaration contains comments explaining why
29 the unit is not implemented.
30
31
32
33 ``Ada`` *(A.2)*
34 This is a parent package for all the standard library packages. It is
35 usually included implicitly in your program, and itself contains no
36 useful data or routines.
37
38
39 ``Ada.Assertions`` *(11.4.2)*
40 ``Assertions`` provides the ``Assert`` subprograms, and also
41 the declaration of the ``Assertion_Error`` exception.
42
43
44 ``Ada.Asynchronous_Task_Control`` *(D.11)*
45 ``Asynchronous_Task_Control`` provides low level facilities for task
46 synchronization. It is typically not implemented. See package spec for details.
47
48
49 ``Ada.Calendar`` *(9.6)*
50 ``Calendar`` provides time of day access, and routines for
51 manipulating times and durations.
52
53
54 ``Ada.Calendar.Arithmetic`` *(9.6.1)*
55 This package provides additional arithmetic
56 operations for ``Calendar``.
57
58
59 ``Ada.Calendar.Formatting`` *(9.6.1)*
60 This package provides formatting operations for ``Calendar``.
61
62
63 ``Ada.Calendar.Time_Zones`` *(9.6.1)*
64 This package provides additional ``Calendar`` facilities
65 for handling time zones.
66
67
68 ``Ada.Characters`` *(A.3.1)*
69 This is a dummy parent package that contains no useful entities
70
71
72 ``Ada.Characters.Conversions`` *(A.3.2)*
73 This package provides character conversion functions.
74
75
76 ``Ada.Characters.Handling`` *(A.3.2)*
77 This package provides some basic character handling capabilities,
78 including classification functions for classes of characters (e.g., test
79 for letters, or digits).
80
81
82 ``Ada.Characters.Latin_1`` *(A.3.3)*
83 This package includes a complete set of definitions of the characters
84 that appear in type CHARACTER. It is useful for writing programs that
85 will run in international environments. For example, if you want an
86 upper case E with an acute accent in a string, it is often better to use
87 the definition of ``UC_E_Acute`` in this package. Then your program
88 will print in an understandable manner even if your environment does not
89 support these extended characters.
90
91
92 ``Ada.Command_Line`` *(A.15)*
93 This package provides access to the command line parameters and the name
94 of the current program (analogous to the use of ``argc`` and ``argv``
95 in C), and also allows the exit status for the program to be set in a
96 system-independent manner.
97
98
99 ``Ada.Complex_Text_IO`` *(G.1.3)*
100 This package provides text input and output of complex numbers.
101
102
103 ``Ada.Containers`` *(A.18.1)*
104 A top level package providing a few basic definitions used by all the
105 following specific child packages that provide specific kinds of
106 containers.
107
108 ``Ada.Containers.Bounded_Priority_Queues`` *(A.18.31)*
109
110 ``Ada.Containers.Bounded_Synchronized_Queues`` *(A.18.29)*
111
112 ``Ada.Containers.Doubly_Linked_Lists`` *(A.18.3)*
113
114 ``Ada.Containers.Generic_Array_Sort`` *(A.18.26)*
115
116 ``Ada.Containers.Generic_Constrained_Array_Sort`` *(A.18.26)*
117
118 ``Ada.Containers.Generic_Sort`` *(A.18.26)*
119
120 ``Ada.Containers.Hashed_Maps`` *(A.18.5)*
121
122 ``Ada.Containers.Hashed_Sets`` *(A.18.8)*
123
124 ``Ada.Containers.Indefinite_Doubly_Linked_Lists`` *(A.18.12)*
125
126 ``Ada.Containers.Indefinite_Hashed_Maps`` *(A.18.13)*
127
128 ``Ada.Containers.Indefinite_Hashed_Sets`` *(A.18.15)*
129
130 ``Ada.Containers.Indefinite_Holders`` *(A.18.18)*
131
132 ``Ada.Containers.Indefinite_Multiway_Trees`` *(A.18.17)*
133
134 ``Ada.Containers.Indefinite_Ordered_Maps`` *(A.18.14)*
135
136 ``Ada.Containers.Indefinite_Ordered_Sets`` *(A.18.16)*
137
138 ``Ada.Containers.Indefinite_Vectors`` *(A.18.11)*
139
140 ``Ada.Containers.Multiway_Trees`` *(A.18.10)*
141
142 ``Ada.Containers.Ordered_Maps`` *(A.18.6)*
143
144 ``Ada.Containers.Ordered_Sets`` *(A.18.9)*
145
146 ``Ada.Containers.Synchronized_Queue_Interfaces`` *(A.18.27)*
147
148 ``Ada.Containers.Unbounded_Priority_Queues`` *(A.18.30)*
149
150 ``Ada.Containers.Unbounded_Synchronized_Queues`` *(A.18.28)*
151
152 ``Ada.Containers.Vectors`` *(A.18.2)*
153
154 ``Ada.Directories`` *(A.16)*
155 This package provides operations on directories.
156
157
158 ``Ada.Directories.Hierarchical_File_Names`` *(A.16.1)*
159 This package provides additional directory operations handling
160 hierarchical file names.
161
162
163 ``Ada.Directories.Information`` *(A.16)*
164 This is an implementation defined package for additional directory
165 operations, which is not implemented in GNAT.
166
167
168 ``Ada.Decimal`` *(F.2)*
169 This package provides constants describing the range of decimal numbers
170 implemented, and also a decimal divide routine (analogous to the COBOL
171 verb DIVIDE ... GIVING ... REMAINDER ...)
172
173
174 ``Ada.Direct_IO`` *(A.8.4)*
175 This package provides input-output using a model of a set of records of
176 fixed-length, containing an arbitrary definite Ada type, indexed by an
177 integer record number.
178
179
180 ``Ada.Dispatching`` *(D.2.1)*
181 A parent package containing definitions for task dispatching operations.
182
183
184 ``Ada.Dispatching.EDF`` *(D.2.6)*
185 Not implemented in GNAT.
186
187
188 ``Ada.Dispatching.Non_Preemptive`` *(D.2.4)*
189 Not implemented in GNAT.
190
191
192 ``Ada.Dispatching.Round_Robin`` *(D.2.5)*
193 Not implemented in GNAT.
194
195
196 ``Ada.Dynamic_Priorities`` *(D.5)*
197 This package allows the priorities of a task to be adjusted dynamically
198 as the task is running.
199
200
201 ``Ada.Environment_Variables`` *(A.17)*
202 This package provides facilities for accessing environment variables.
203
204
205 ``Ada.Exceptions`` *(11.4.1)*
206 This package provides additional information on exceptions, and also
207 contains facilities for treating exceptions as data objects, and raising
208 exceptions with associated messages.
209
210
211 ``Ada.Execution_Time`` *(D.14)*
212 This package provides CPU clock functionalities. It is not implemented on
213 all targets (see package spec for details).
214
215
216 ``Ada.Execution_Time.Group_Budgets`` *(D.14.2)*
217 Not implemented in GNAT.
218
219
220 ``Ada.Execution_Time.Timers`` *(D.14.1)'*
221 Not implemented in GNAT.
222
223
224 ``Ada.Finalization`` *(7.6)*
225 This package contains the declarations and subprograms to support the
226 use of controlled types, providing for automatic initialization and
227 finalization (analogous to the constructors and destructors of C++).
228
229
230 ``Ada.Float_Text_IO`` *(A.10.9)*
231 A library level instantiation of Text_IO.Float_IO for type Float.
232
233
234 ``Ada.Float_Wide_Text_IO`` *(A.10.9)*
235 A library level instantiation of Wide_Text_IO.Float_IO for type Float.
236
237
238 ``Ada.Float_Wide_Wide_Text_IO`` *(A.10.9)*
239 A library level instantiation of Wide_Wide_Text_IO.Float_IO for type Float.
240
241
242 ``Ada.Integer_Text_IO`` *(A.10.9)*
243 A library level instantiation of Text_IO.Integer_IO for type Integer.
244
245
246 ``Ada.Integer_Wide_Text_IO`` *(A.10.9)*
247 A library level instantiation of Wide_Text_IO.Integer_IO for type Integer.
248
249
250 ``Ada.Integer_Wide_Wide_Text_IO`` *(A.10.9)*
251 A library level instantiation of Wide_Wide_Text_IO.Integer_IO for type Integer.
252
253
254 ``Ada.Interrupts`` *(C.3.2)*
255 This package provides facilities for interfacing to interrupts, which
256 includes the set of signals or conditions that can be raised and
257 recognized as interrupts.
258
259
260 ``Ada.Interrupts.Names`` *(C.3.2)*
261 This package provides the set of interrupt names (actually signal
262 or condition names) that can be handled by GNAT.
263
264
265 ``Ada.IO_Exceptions`` *(A.13)*
266 This package defines the set of exceptions that can be raised by use of
267 the standard IO packages.
268
269
270 ``Ada.Iterator_Interfaces`` *(5.5.1)*
271 This package provides a generic interface to generalized iterators.
272
273
274 ``Ada.Locales`` *(A.19)*
275 This package provides declarations providing information (Language
276 and Country) about the current locale.
277
278
279 ``Ada.Numerics``
280 This package contains some standard constants and exceptions used
281 throughout the numerics packages. Note that the constants pi and e are
282 defined here, and it is better to use these definitions than rolling
283 your own.
284
285
286 ``Ada.Numerics.Complex_Arrays`` *(G.3.2)*
287 Provides operations on arrays of complex numbers.
288
289
290 ``Ada.Numerics.Complex_Elementary_Functions``
291 Provides the implementation of standard elementary functions (such as
292 log and trigonometric functions) operating on complex numbers using the
293 standard ``Float`` and the ``Complex`` and ``Imaginary`` types
294 created by the package ``Numerics.Complex_Types``.
295
296
297 ``Ada.Numerics.Complex_Types``
298 This is a predefined instantiation of
299 ``Numerics.Generic_Complex_Types`` using ``Standard.Float`` to
300 build the type ``Complex`` and ``Imaginary``.
301
302
303 ``Ada.Numerics.Discrete_Random``
304 This generic package provides a random number generator suitable for generating
305 uniformly distributed values of a specified discrete subtype. It should not be
306 used as a cryptographic pseudo-random source.
307
308
309 ``Ada.Numerics.Float_Random``
310 This package provides a random number generator suitable for generating
311 uniformly distributed floating point values in the unit interval. It should not
312 be used as a cryptographic pseudo-random source.
313
314
315 ``Ada.Numerics.Generic_Complex_Elementary_Functions``
316 This is a generic version of the package that provides the
317 implementation of standard elementary functions (such as log and
318 trigonometric functions) for an arbitrary complex type.
319
320 The following predefined instantiations of this package are provided:
321
322 * ``Short_Float``
323
324 ``Ada.Numerics.Short_Complex_Elementary_Functions``
325
326 * ``Float``
327
328 ``Ada.Numerics.Complex_Elementary_Functions``
329
330 * ``Long_Float``
331
332 ``Ada.Numerics.Long_Complex_Elementary_Functions``
333
334 ``Ada.Numerics.Generic_Complex_Types``
335 This is a generic package that allows the creation of complex types,
336 with associated complex arithmetic operations.
337
338 The following predefined instantiations of this package exist
339
340 * ``Short_Float``
341
342 ``Ada.Numerics.Short_Complex_Complex_Types``
343
344 * ``Float``
345
346 ``Ada.Numerics.Complex_Complex_Types``
347
348 * ``Long_Float``
349
350 ``Ada.Numerics.Long_Complex_Complex_Types``
351
352 ``Ada.Numerics.Generic_Elementary_Functions``
353 This is a generic package that provides the implementation of standard
354 elementary functions (such as log an trigonometric functions) for an
355 arbitrary float type.
356
357 The following predefined instantiations of this package exist
358
359 * ``Short_Float``
360
361 ``Ada.Numerics.Short_Elementary_Functions``
362
363 * ``Float``
364
365 ``Ada.Numerics.Elementary_Functions``
366
367 * ``Long_Float``
368
369 ``Ada.Numerics.Long_Elementary_Functions``
370
371 ``Ada.Numerics.Generic_Real_Arrays`` *(G.3.1)*
372 Generic operations on arrays of reals
373
374 ``Ada.Numerics.Real_Arrays`` *(G.3.1)*
375 Preinstantiation of Ada.Numerics.Generic_Real_Arrays (Float).
376
377 ``Ada.Real_Time`` *(D.8)*
378 This package provides facilities similar to those of ``Calendar``, but
379 operating with a finer clock suitable for real time control. Note that
380 annex D requires that there be no backward clock jumps, and GNAT generally
381 guarantees this behavior, but of course if the external clock on which
382 the GNAT runtime depends is deliberately reset by some external event,
383 then such a backward jump may occur.
384
385 ``Ada.Real_Time.Timing_Events`` *(D.15)*
386 This package allows procedures to be executed at a specified time without
387 the use of a task or a delay statement.
388
389 ``Ada.Sequential_IO`` *(A.8.1)*
390 This package provides input-output facilities for sequential files,
391 which can contain a sequence of values of a single type, which can be
392 any Ada type, including indefinite (unconstrained) types.
393
394 ``Ada.Storage_IO`` *(A.9)*
395 This package provides a facility for mapping arbitrary Ada types to and
396 from a storage buffer. It is primarily intended for the creation of new
397 IO packages.
398
399 ``Ada.Streams`` *(13.13.1)*
400 This is a generic package that provides the basic support for the
401 concept of streams as used by the stream attributes (``Input``,
402 ``Output``, ``Read`` and ``Write``).
403
404 ``Ada.Streams.Stream_IO`` *(A.12.1)*
405 This package is a specialization of the type ``Streams`` defined in
406 package ``Streams`` together with a set of operations providing
407 Stream_IO capability. The Stream_IO model permits both random and
408 sequential access to a file which can contain an arbitrary set of values
409 of one or more Ada types.
410
411 ``Ada.Strings`` *(A.4.1)*
412 This package provides some basic constants used by the string handling
413 packages.
414
415
416 ``Ada.Strings.Bounded`` *(A.4.4)*
417 This package provides facilities for handling variable length
418 strings. The bounded model requires a maximum length. It is thus
419 somewhat more limited than the unbounded model, but avoids the use of
420 dynamic allocation or finalization.
421
422 ``Ada.Strings.Bounded.Equal_Case_Insensitive`` *(A.4.10)*
423 Provides case-insensitive comparisons of bounded strings
424
425 ``Ada.Strings.Bounded.Hash`` *(A.4.9)*
426 This package provides a generic hash function for bounded strings
427
428 ``Ada.Strings.Bounded.Hash_Case_Insensitive`` *(A.4.9)*
429 This package provides a generic hash function for bounded strings that
430 converts the string to be hashed to lower case.
431
432 ``Ada.Strings.Bounded.Less_Case_Insensitive`` *(A.4.10)*
433 This package provides a comparison function for bounded strings that works
434 in a case insensitive manner by converting to lower case before the comparison.
435
436 ``Ada.Strings.Fixed`` *(A.4.3)*
437 This package provides facilities for handling fixed length strings.
438
439 ``Ada.Strings.Fixed.Equal_Case_Insensitive`` *(A.4.10)*
440 This package provides an equality function for fixed strings that compares
441 the strings after converting both to lower case.
442
443 ``Ada.Strings.Fixed.Hash_Case_Insensitive`` *(A.4.9)*
444 This package provides a case insensitive hash function for fixed strings that
445 converts the string to lower case before computing the hash.
446
447 ``Ada.Strings.Fixed.Less_Case_Insensitive`` *(A.4.10)*
448 This package provides a comparison function for fixed strings that works
449 in a case insensitive manner by converting to lower case before the comparison.
450
451 ``Ada.Strings.Hash`` *(A.4.9)*
452 This package provides a hash function for strings.
453
454 ``Ada.Strings.Hash_Case_Insensitive`` *(A.4.9)*
455 This package provides a hash function for strings that is case insensitive.
456 The string is converted to lower case before computing the hash.
457
458 ``Ada.Strings.Less_Case_Insensitive`` *(A.4.10)*
459 This package provides a comparison function for\\strings that works
460 in a case insensitive manner by converting to lower case before the comparison.
461
462 ``Ada.Strings.Maps`` *(A.4.2)*
463 This package provides facilities for handling character mappings and
464 arbitrarily defined subsets of characters. For instance it is useful in
465 defining specialized translation tables.
466
467 ``Ada.Strings.Maps.Constants`` *(A.4.6)*
468 This package provides a standard set of predefined mappings and
469 predefined character sets. For example, the standard upper to lower case
470 conversion table is found in this package. Note that upper to lower case
471 conversion is non-trivial if you want to take the entire set of
472 characters, including extended characters like E with an acute accent,
473 into account. You should use the mappings in this package (rather than
474 adding 32 yourself) to do case mappings.
475
476 ``Ada.Strings.Unbounded`` *(A.4.5)*
477 This package provides facilities for handling variable length
478 strings. The unbounded model allows arbitrary length strings, but
479 requires the use of dynamic allocation and finalization.
480
481 ``Ada.Strings.Unbounded.Equal_Case_Insensitive`` *(A.4.10)*
482 Provides case-insensitive comparisons of unbounded strings
483
484 ``Ada.Strings.Unbounded.Hash`` *(A.4.9)*
485 This package provides a generic hash function for unbounded strings
486
487 ``Ada.Strings.Unbounded.Hash_Case_Insensitive`` *(A.4.9)*
488 This package provides a generic hash function for unbounded strings that
489 converts the string to be hashed to lower case.
490
491 ``Ada.Strings.Unbounded.Less_Case_Insensitive`` *(A.4.10)*
492 This package provides a comparison function for unbounded strings that works
493 in a case insensitive manner by converting to lower case before the comparison.
494
495 ``Ada.Strings.UTF_Encoding`` *(A.4.11)*
496 This package provides basic definitions for dealing with UTF-encoded strings.
497
498 ``Ada.Strings.UTF_Encoding.Conversions`` *(A.4.11)*
499 This package provides conversion functions for UTF-encoded strings.
500
501 ``Ada.Strings.UTF_Encoding.Strings`` *(A.4.11)*
502
503 ``Ada.Strings.UTF_Encoding.Wide_Strings`` *(A.4.11)*
504
505 ``Ada.Strings.UTF_Encoding.Wide_Wide_Strings`` *(A.4.11)*
506 These packages provide facilities for handling UTF encodings for
507 Strings, Wide_Strings and Wide_Wide_Strings.
508
509 ``Ada.Strings.Wide_Bounded`` *(A.4.7)*
510
511 ``Ada.Strings.Wide_Fixed`` *(A.4.7)*
512
513 ``Ada.Strings.Wide_Maps`` *(A.4.7)*
514
515 ``Ada.Strings.Wide_Unbounded`` *(A.4.7)*
516 These packages provide analogous capabilities to the corresponding
517 packages without ``Wide_`` in the name, but operate with the types
518 ``Wide_String`` and ``Wide_Character`` instead of ``String``
519 and ``Character``. Versions of all the child packages are available.
520
521 ``Ada.Strings.Wide_Wide_Bounded`` *(A.4.7)*
522
523 ``Ada.Strings.Wide_Wide_Fixed`` *(A.4.7)*
524
525 ``Ada.Strings.Wide_Wide_Maps`` *(A.4.7)*
526
527 ``Ada.Strings.Wide_Wide_Unbounded`` *(A.4.7)*
528 These packages provide analogous capabilities to the corresponding
529 packages without ``Wide_`` in the name, but operate with the types
530 ``Wide_Wide_String`` and ``Wide_Wide_Character`` instead
531 of ``String`` and ``Character``.
532
533 ``Ada.Synchronous_Barriers`` *(D.10.1)*
534 This package provides facilities for synchronizing tasks at a low level
535 with barriers.
536
537 ``Ada.Synchronous_Task_Control`` *(D.10)*
538 This package provides some standard facilities for controlling task
539 communication in a synchronous manner.
540
541 ``Ada.Synchronous_Task_Control.EDF`` *(D.10)*
542 Not implemented in GNAT.
543
544 ``Ada.Tags``
545 This package contains definitions for manipulation of the tags of tagged
546 values.
547
548 ``Ada.Tags.Generic_Dispatching_Constructor`` *(3.9)*
549 This package provides a way of constructing tagged class-wide values given
550 only the tag value.
551
552 ``Ada.Task_Attributes`` *(C.7.2)*
553 This package provides the capability of associating arbitrary
554 task-specific data with separate tasks.
555
556 ``Ada.Task_Identification`` *(C.7.1)*
557 This package provides capabilities for task identification.
558
559 ``Ada.Task_Termination`` *(C.7.3)*
560 This package provides control over task termination.
561
562 ``Ada.Text_IO``
563 This package provides basic text input-output capabilities for
564 character, string and numeric data. The subpackages of this
565 package are listed next. Note that although these are defined
566 as subpackages in the RM, they are actually transparently
567 implemented as child packages in GNAT, meaning that they
568 are only loaded if needed.
569
570 ``Ada.Text_IO.Decimal_IO``
571 Provides input-output facilities for decimal fixed-point types
572
573 ``Ada.Text_IO.Enumeration_IO``
574 Provides input-output facilities for enumeration types.
575
576 ``Ada.Text_IO.Fixed_IO``
577 Provides input-output facilities for ordinary fixed-point types.
578
579 ``Ada.Text_IO.Float_IO``
580 Provides input-output facilities for float types. The following
581 predefined instantiations of this generic package are available:
582
583 * ``Short_Float``
584
585 ``Short_Float_Text_IO``
586
587 * ``Float``
588
589 ``Float_Text_IO``
590
591 * ``Long_Float``
592
593 ``Long_Float_Text_IO``
594
595 ``Ada.Text_IO.Integer_IO``
596 Provides input-output facilities for integer types. The following
597 predefined instantiations of this generic package are available:
598
599 * ``Short_Short_Integer``
600
601 ``Ada.Short_Short_Integer_Text_IO``
602
603 * ``Short_Integer``
604
605 ``Ada.Short_Integer_Text_IO``
606
607 * ``Integer``
608
609 ``Ada.Integer_Text_IO``
610
611 * ``Long_Integer``
612
613 ``Ada.Long_Integer_Text_IO``
614
615 * ``Long_Long_Integer``
616
617 ``Ada.Long_Long_Integer_Text_IO``
618
619 ``Ada.Text_IO.Modular_IO``
620 Provides input-output facilities for modular (unsigned) types.
621
622 ``Ada.Text_IO.Bounded_IO (A.10.11)``
623 Provides input-output facilities for bounded strings.
624
625 ``Ada.Text_IO.Complex_IO (G.1.3)``
626 This package provides basic text input-output capabilities for complex
627 data.
628
629 ``Ada.Text_IO.Editing (F.3.3)``
630 This package contains routines for edited output, analogous to the use
631 of pictures in COBOL. The picture formats used by this package are a
632 close copy of the facility in COBOL.
633
634 ``Ada.Text_IO.Text_Streams (A.12.2)``
635 This package provides a facility that allows Text_IO files to be treated
636 as streams, so that the stream attributes can be used for writing
637 arbitrary data, including binary data, to Text_IO files.
638
639 ``Ada.Text_IO.Unbounded_IO (A.10.12)``
640 This package provides input-output facilities for unbounded strings.
641
642 ``Ada.Unchecked_Conversion (13.9)``
643 This generic package allows arbitrary conversion from one type to
644 another of the same size, providing for breaking the type safety in
645 special circumstances.
646
647 If the types have the same Size (more accurately the same Value_Size),
648 then the effect is simply to transfer the bits from the source to the
649 target type without any modification. This usage is well defined, and
650 for simple types whose representation is typically the same across
651 all implementations, gives a portable method of performing such
652 conversions.
653
654 If the types do not have the same size, then the result is implementation
655 defined, and thus may be non-portable. The following describes how GNAT
656 handles such unchecked conversion cases.
657
658 If the types are of different sizes, and are both discrete types, then
659 the effect is of a normal type conversion without any constraint checking.
660 In particular if the result type has a larger size, the result will be
661 zero or sign extended. If the result type has a smaller size, the result
662 will be truncated by ignoring high order bits.
663
664 If the types are of different sizes, and are not both discrete types,
665 then the conversion works as though pointers were created to the source
666 and target, and the pointer value is converted. The effect is that bits
667 are copied from successive low order storage units and bits of the source
668 up to the length of the target type.
669
670 A warning is issued if the lengths differ, since the effect in this
671 case is implementation dependent, and the above behavior may not match
672 that of some other compiler.
673
674 A pointer to one type may be converted to a pointer to another type using
675 unchecked conversion. The only case in which the effect is undefined is
676 when one or both pointers are pointers to unconstrained array types. In
677 this case, the bounds information may get incorrectly transferred, and in
678 particular, GNAT uses double size pointers for such types, and it is
679 meaningless to convert between such pointer types. GNAT will issue a
680 warning if the alignment of the target designated type is more strict
681 than the alignment of the source designated type (since the result may
682 be unaligned in this case).
683
684 A pointer other than a pointer to an unconstrained array type may be
685 converted to and from System.Address. Such usage is common in Ada 83
686 programs, but note that Ada.Address_To_Access_Conversions is the
687 preferred method of performing such conversions in Ada 95 and Ada 2005.
688 Neither
689 unchecked conversion nor Ada.Address_To_Access_Conversions should be
690 used in conjunction with pointers to unconstrained objects, since
691 the bounds information cannot be handled correctly in this case.
692
693 ``Ada.Unchecked_Deallocation`` *(13.11.2)*
694 This generic package allows explicit freeing of storage previously
695 allocated by use of an allocator.
696
697 ``Ada.Wide_Text_IO`` *(A.11)*
698 This package is similar to ``Ada.Text_IO``, except that the external
699 file supports wide character representations, and the internal types are
700 ``Wide_Character`` and ``Wide_String`` instead of ``Character``
701 and ``String``. The corresponding set of nested packages and child
702 packages are defined.
703
704 ``Ada.Wide_Wide_Text_IO`` *(A.11)*
705 This package is similar to ``Ada.Text_IO``, except that the external
706 file supports wide character representations, and the internal types are
707 ``Wide_Character`` and ``Wide_String`` instead of ``Character``
708 and ``String``. The corresponding set of nested packages and child
709 packages are defined.
710
711 For packages in Interfaces and System, all the RM defined packages are
712 available in GNAT, see the Ada 2012 RM for full details.