F.2 Compatibility between Ada 95 and Ada 2005
Although Ada 2005 was designed to be upwards compatible with Ada 95, there are
a number of incompatibilities. Several are enumerated below;
for a complete description please see the
Annotated Ada 2005 Reference Manual, or section 9.1.1 in
Rationale for Ada 2005.
- New reserved words.
- The words
interface
, overriding
and synchronized
are
reserved in Ada 2005.
A pre-Ada 2005 program that uses any of these as an identifier will be
illegal.
- New declarations in predefined packages.
- A number of packages in the predefined environment contain new declarations:
Ada.Exceptions
, Ada.Real_Time
, Ada.Strings
,
Ada.Strings.Fixed
, Ada.Strings.Bounded
,
Ada.Strings.Unbounded
, Ada.Strings.Wide_Fixed
,
Ada.Strings.Wide_Bounded
, Ada.Strings.Wide_Unbounded
,
Ada.Tags
, Ada.Text_IO
, and Interfaces.C
.
If an Ada 95 program does a with
and use
of any of these
packages, the new declarations may cause name clashes.
- Access parameters.
- A nondispatching subprogram with an access parameter cannot be renamed
as a dispatching operation. This was permitted in Ada 95.
- Access types, discriminants, and constraints.
- Rule changes in this area have led to some incompatibilities; for example,
constrained subtypes of some access types are not permitted in Ada 2005.
- Aggregates for limited types.
- The allowance of aggregates for limited types in Ada 2005 raises the
possibility of ambiguities in legal Ada 95 programs, since additional types
now need to be considered in expression resolution.
- Fixed-point multiplication and division.
- Certain expressions involving “*” or “/” for a fixed-point type, which
were legal in Ada 95 and invoked the predefined versions of these operations,
are now ambiguous.
The ambiguity may be resolved either by applying a type conversion to the
expression, or by explicitly invoking the operation from package
Standard
.
- Return-by-reference types.
- The Ada 95 return-by-reference mechanism has been removed. Instead, the user
can declare a function returning a value from an anonymous access type.