Ada 95 Quality and Style Guide Chapter 7
7.4.5 Task Scheduling Algorithm
guideline
guideline
guideline
You should exercise care when using predefined exceptions because
aspects of their treatment may vary between implementations. Implementation-specific
exceptions must, of course, be avoided. See Guidelines 4.3 and
5.8 for further information on exceptions. See Guideline 7.1.6
for further information on vendor-supplied features.
7.5.1 Predefined and User-Defined Exceptions
guideline
guideline
Ada provides many implementation-dependent features that permit
greater control over and interaction with the underlying hardware
architecture than is normally provided by a high-order language.
These mechanisms are intended to assist in systems programming
and real-time programming to obtain greater efficiency (e.g.,
specific size and layout of variables through representation clauses)
and direct hardware interaction (e.g., interrupt entries) without
having to resort to assembly level programming.
Given the objectives for these features, it is not surprising
that you must usually pay a significant price in portability to
use them. In general, where portability is the main objective,
do not use these features. When you must use these features, encapsulate
them in packages that are well-commented as interfacing to the
particular target environment. This section identifies the various
features and their recommended use with respect to portability.
7.6.1 Representation Clauses
guideline
notes
guideline
guideline
guideline
rationale
guideline
guideline
guideline
guideline
guideline
I/O facilities in Ada are not a part of the syntactic definition
of the language. The constructs in the language have been used
to define a set of packages for this purpose. These packages are
not expected to meet all the I/O needs of all applications, in
particular, embedded systems. They serve as a core subset that
may be used on straightforward data and that can be used as examples
of building I/O facilities upon the low-level constructs provided
by the language. Providing an I/O definition that could meet the
requirements of all applications and integrate with the many existing
operating systems would result in unacceptable implementation
dependencies.
The types of portability problems encountered with I/O tend to
be different for applications running with a host operating system
versus embedded targets where the Ada run-time is self-sufficient.
Interacting with a host operating system offers the added complexity
of coexisting with the host file system structures (e.g., hierarchical
directories), access methods (e.g., indexed sequential access
method [ISAM]), and naming conventions (e.g., logical names and
aliases based on the current directory). The section on Input/Output
in ARTEWG (1986) provides some examples of this kind of dependency.
Embedded applications have different dependencies that often tie
them to the low-level details of their hardware devices.
The major defense against these inherent implementation dependencies
in I/O is to try to isolate their functionality in any given application.
The majority of the following guidelines are focused in this direction.
7.7.1 Name and Form Parameters
guideline
guideline
guideline
guideline
guideline
rationale
fundamentals
rationale
notes
exceptions
7.4.6 Abort
rationale
7.4.7 Unprotected Shared Variables and Pragmas Atomic and Volatile
example
rationale
7.5 EXCEPTIONS
rationale
7.5.2 Implementation-Specific Exceptions
rationale
7.6 REPRESENTATION CLAUSES AND IMPLEMENTATION-DEPENDENT FEATURES
rationale
Therefore, two independently linked programs or partitions should
only share data that has their representations explicitly controlled.
rationale
notes
exceptions
7.6.3 Machine Code Inserts
rationale
exceptions
7.6.4 Interfacing to Foreign Languages
example
rationale
7.6.6 Unchecked Deallocation
rationale
notes
exceptions
7.6.7 Unchecked Access
rationale
7.6.8 Unchecked Conversion
rationale
exceptions
7.6.9 Run-Time Dependencies
rationale
exceptions
run-time support system.
7.7 INPUT/OUTPUT
rationale
notes
7.7.2 File Closing
rationale
7.7.3 Input/Output on Access Types
rationale
7.7.4 Package Ada.Streams.Stream_IO
rationale
7.7.5 Current Error Files
example
7.8 SUMMARY
numeric types and expressions
storage control
tasking
exceptions
representation clauses and implementation-dependent features
input/output
run-time support system.
In This Guide:
Table of Contents
Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Appendix
References
Bibliography
Index