Previous: Representation Clauses, Up: Compatibility and Porting Guide


E.5 Compatibility with HP Ada 83

The VMS version of GNAT fully implements all the pragmas and attributes provided by HP Ada 83, as well as providing the standard HP Ada 83 libraries, including Starlet. In addition, data layouts and parameter passing conventions are highly compatible. This means that porting existing HP Ada 83 code to GNAT in VMS systems should be easier than most other porting efforts. The following are some of the most significant differences between GNAT and HP Ada 83.

Default floating-point representation
In GNAT, the default floating-point format is IEEE, whereas in HP Ada 83, it is VMS format. GNAT does implement the necessary pragmas (Long_Float, Float_Representation) for changing this default.
System
The package System in GNAT exactly corresponds to the definition in the Ada 95 reference manual, which means that it excludes many of the HP Ada 83 extensions. However, a separate package Aux_DEC is provided that contains the additional definitions, and a special pragma, Extend_System allows this package to be treated transparently as an extension of package System.
To_Address
The definitions provided by Aux_DEC are exactly compatible with those in the HP Ada 83 version of System, with one exception. HP Ada provides the following declarations:
          TO_ADDRESS (INTEGER)
          TO_ADDRESS (UNSIGNED_LONGWORD)
          TO_ADDRESS (universal_integer)
     

The version of TO_ADDRESS taking a universal integer argument is in fact an extension to Ada 83 not strictly compatible with the reference manual. In GNAT, we are constrained to be exactly compatible with the standard, and this means we cannot provide this capability. In HP Ada 83, the point of this definition is to deal with a call like:

          TO_ADDRESS (16#12777#);
     

Normally, according to the Ada 83 standard, one would expect this to be ambiguous, since it matches both the INTEGER and UNSIGNED_LONGWORD forms of TO_ADDRESS. However, in HP Ada 83, there is no ambiguity, since the definition using universal_integer takes precedence.

In GNAT, since the version with universal_integer cannot be supplied, it is not possible to be 100% compatible. Since there are many programs using numeric constants for the argument to TO_ADDRESS, the decision in GNAT was to change the name of the function in the UNSIGNED_LONGWORD case, so the declarations provided in the GNAT version of AUX_Dec are:

          function To_Address (X : Integer) return Address;
          pragma Pure_Function (To_Address);
          
          function To_Address_Long (X : Unsigned_Longword)
           return Address;
          pragma Pure_Function (To_Address_Long);
     

This means that programs using TO_ADDRESS for UNSIGNED_LONGWORD must change the name to TO_ADDRESS_LONG.

Task_Id values
The Task_Id values assigned will be different in the two systems, and GNAT does not provide a specified value for the Task_Id of the environment task, which in GNAT is treated like any other declared task.

For full details on these and other less significant compatibility issues, see appendix E of the HP publication entitled HP Ada, Technical Overview and Comparison on HP Platforms.

For GNAT running on other than VMS systems, all the HP Ada 83 pragmas and attributes are recognized, although only a subset of them can sensibly be implemented. The description of pragmas in the GNAT Reference Manual indicates whether or not they are applicable to non-VMS systems.