Next: , Previous: Pragma Debug_Policy, Up: Implementation Defined Pragmas


2.44 Pragma Default_Scalar_Storage_Order

Syntax:

    pragma Default_Scalar_Storage_Order (High_Order_First | Low_Order_First);

Normally if no explicit Scalar_Storage_Order is given for a record type or array type, then the scalar storage order defaults to the ordinary default for the target. But this default may be overridden using this pragma. The pragma may appear as a configuration pragma, or locally within a package spec or declarative part. In the latter case, it applies to all subsequent types declared within that package spec or declarative part.

The following example shows the use of this pragma:

    pragma Default_Scalar_Storage_Order (High_Order_First);
    with System; use System;
    package DSSO1 is
       type H1 is record
          a : Integer;
       end record;
    
       type L2 is record
          a : Integer;
       end record;
       for L2'Scalar_Storage_Order use Low_Order_First;
    
       type L2a is new L2;
    
       package Inner is
          type H3 is record
             a : Integer;
          end record;
    
          pragma Default_Scalar_Storage_Order (Low_Order_First);
    
          type L4 is record
             a : Integer;
          end record;
       end Inner;
    
       type H4a is new Inner.L4;
    
       type H5 is record
          a : Integer;
       end record;
    end DSSO1;

In this example record types L.. have Low_Order_First scalar storage order, and record types H.. have High_Order_First. Note that in the case of H4a, the order is not inherited from the parent type. Only an explicitly set Scalar_Storage_Order gets inherited on type derivation.

If this pragma is used as a configuration pragma which appears within a configuration pragma file (as opposed to appearing explicitly at the start of a single unit), then the binder will require that all units in a partition be compiled in a similar manner, other than run-time units, which are not affected by this pragma. Note that the use of this form is discouraged because it may significantly degrade the run-time performance of the software, instead the default scalar storage order ought to be changed only on a local basis.