Next: , Previous: Implementation Advice, Up: Top


7 Implementation Defined Characteristics

In addition to the implementation dependent pragmas and attributes, and the implementation advice, there are a number of other Ada features that are potentially implementation dependent and are designated as implementation-defined. These are mentioned throughout the Ada Reference Manual, and are summarized in Annex M.

A requirement for conforming Ada compilers is that they provide documentation describing how the implementation deals with each of these issues. In this chapter you will find each point in Annex M listed, followed by a description of how GNAT handles the implementation dependence.

You can use this chapter as a guide to minimizing implementation dependent features in your programs if portability to other compilers and other operating systems is an important consideration. The numbers in each entry below correspond to the paragraph numbers in the Ada Reference Manual.

See Implementation Advice.

The complexity of programs that can be processed is limited only by the total amount of available virtual memory, and disk space for the generated object files.

There are no variations from the standard.

Any code_statement can potentially cause external interactions.

See separate section on source representation.

See separate section on source representation.

See separate section on source representation.

The maximum line length is 255 characters and the maximum length of a lexical element is also 255 characters. This is the default setting if not overridden by the use of compiler switch `-gnaty' (which sets the maximum to 79) or `-gnatyMnn' which allows the maximum line length to be specified to be any value up to 32767. The maximum length of a lexical element is the same as the maximum line length.

See Implementation Defined Pragmas.

Pragma Optimize, if given with a Time or Space parameter, checks that the optimization flag is set, and aborts if it is not.

The sequence of characters is as defined by the wide character encoding method used for the source. See section on source representation for further details.

Type

Representation


`Short_Short_Integer'

8 bit signed


`Short_Integer'

(Short) 16 bit signed


`Integer'

32 bit signed


`Long_Integer'

64 bit signed (on most 64 bit targets, depending on the C definition of long). 32 bit signed (all other targets)


`Long_Long_Integer'

64 bit signed

There are no nonstandard integer types.

There are no nonstandard real types.

The precision and range is as defined by the IEEE standard.

Type

Representation


`Short_Float'

32 bit IEEE short


`Float'

(Short) 32 bit IEEE short


`Long_Float'

64 bit IEEE long


`Long_Long_Float'

64 bit IEEE long (80 bit IEEE long on x86 processors)

Fine_Delta is 2**(-63)

Any combinations are permitted that do not result in a small less than Fine_Delta and do not result in a mantissa larger than 63 bits. If the mantissa is larger than 53 bits on machines where Long_Long_Float is 64 bits (true of all architectures except ia32), then the output from Text_IO is accurate to only 53 bits, rather than the full mantissa. This is because floating-point conversions are used to convert fixed point.

Block numbers of the form B`nnn`, where nnn is a decimal integer are allocated.

See Implementation Defined Attributes.

There are no implementation-defined time types.

See 9.6(20). The time base used is that provided by the C library function gettimeofday.

The time base used is that provided by the C library function gettimeofday.

The time zone used by package Calendar is the current system time zone setting for local time, as accessed by the C library function localtime.

There are no such limits.

Separate components are independently addressable if they do not share overlapping storage units.

A compilation is represented by a sequence of files presented to the compiler in a single invocation of the `gcc' command.

No single file can contain more than one compilation unit, but any sequence of files can be presented to the compiler as a single compilation.

See separate section on compilation model.

If a unit contains an Ada main program, then the Ada units for the partition are determined by recursive application of the rules in the Ada Reference Manual section 10.2(2-6). In other words, the Ada units will be those that are needed by the main program, and then this definition of need is applied recursively to those units, and the partition contains the transitive closure determined by this relationship. In short, all the necessary units are included, with no need to explicitly specify the list. If additional units are required, e.g., by foreign language units, then all units must be mentioned in the context clause of one of the needed Ada units.

If the partition contains no main program, or if the main program is in a language other than Ada, then GNAT provides the binder options `-z' and `-n' respectively, and in this case a list of units can be explicitly supplied to the binder for inclusion in the partition (all units needed by these units will also be included automatically). For full details on the use of these options, refer to the GNAT Make Program gnatmake in the GNAT User's Guide.

The units needed by a given compilation unit are as defined in the Ada Reference Manual section 10.2(2-6). There are no implementation-defined pragmas or other implementation-defined means for specifying needed units.

The main program is designated by providing the name of the corresponding ALI file as the input parameter to the binder.

The first constraint on ordering is that it meets the requirements of Chapter 10 of the Ada Reference Manual. This still leaves some implementation dependent choices, which are resolved by first elaborating bodies as early as possible (i.e., in preference to specs where there is a choice), and second by evaluating the immediate with clauses of a unit to determine the probably best choice, and third by elaborating in alphabetical order of unit names where a choice still remains.

The main program has no parameters. It may be a procedure, or a function returning an integer type. In the latter case, the returned integer value is the return code of the program (overriding any value that may have been set by a call to Ada.Command_Line.Set_Exit_Status).

GNAT itself supports programs with only a single partition. The GNATDIST tool provided with the GLADE package (which also includes an implementation of the PCS) provides a completely flexible method for building and running programs consisting of multiple partitions. See the separate GLADE manual for details.

See separate section on compilation model.

Passive partitions are supported on targets where shared memory is provided by the operating system. See the GLADE reference manual for further details.

Exception message returns the null string unless a specific message has been passed by the program.

Blocks have implementation defined names of the form B`nnn` where nnn is an integer.

Exception_Information returns a string in the following format:

    *Exception_Name:* nnnnn
    *Message:* mmmmm
    *PID:* ppp
    *Load address:* 0xhhhh
    *Call stack traceback locations:*
    0xhhhh 0xhhhh 0xhhhh ... 0xhhh

where

The implementation defined check name Alignment_Check controls checking of address clause values for proper alignment (that is, the address supplied must be consistent with the alignment of the type).

The implementation defined check name Predicate_Check controls whether predicate checks are generated.

The implementation defined check name Validity_Check controls whether validity checks are generated.

In addition, a user program can add implementation-defined check names by means of the pragma Check_Name.

See separate section on data representations.

See separate section on data representations.

Size for an indefinite subtype is the maximum possible size, except that for the case of a subprogram parameter, the size of the parameter object is the actual size.

The default external representation for a type tag is the fully expanded name of the type in upper case letters.

A compilation unit is the same in two different partitions if and only if it derives from the same source file.

The only implementation defined component is the tag for a tagged type, which contains a pointer to the dispatching table.

Word_Size (32) is not the same as Storage_Unit (8) for this implementation, so no non-default bit ordering is supported. The default bit ordering corresponds to the natural endianness of the target architecture.

See the definition of these packages in files system.ads and s-stoele.ads. Note that two declarations are added to package System.

    Max_Priority           : constant Positive := Priority'Last;
    Max_Interrupt_Priority : constant Positive := Interrupt_Priority'Last;

See the definition and documentation in file s-maccod.ads.

Unchecked conversion between types of the same size results in an uninterpreted transmission of the bits from one type to the other. If the types are of unequal sizes, then in the case of discrete types, a shorter source is first zero or sign extended as necessary, and a shorter target is simply truncated on the left. For all non-discrete types, the source is first copied if necessary to ensure that the alignment requirements of the target are met, then a pointer is constructed to the source value, and the result is obtained by dereferencing this pointer after converting it to be a pointer to the target type. Unchecked conversions where the target subtype is an unconstrained array are not permitted. If the target alignment is greater than the source alignment, then a copy of the result is made with appropriate alignment

For assignments and other operations where the use of invalid values cannot result in erroneous behavior, the compiler ignores the possibility of invalid values. An exception is raised at the point where an invalid value would result in erroneous behavior. For example executing:

    procedure invalidvals is
      X : Integer := -1;
      Y : Natural range 1 .. 10;
      for Y'Address use X'Address;
      Z : Natural range 1 .. 10;
      A : array (Natural range 1 .. 10) of Integer;
    begin
      Z := Y;     -- no exception
      A (Z) := 3; -- exception raised;
    end;

As indicated, an exception is raised on the array assignment, but not on the simple assignment of the invalid negative value from Y to Z.

There are 3 different standard pools used by the compiler when Storage_Pool is not specified depending whether the type is local to a subprogram or defined at the library level and whether Storage_Size`is specified or not. See documentation in the runtime library units `System.Pool_Global, System.Pool_Size and System.Pool_Local in files s-poosiz.ads, s-pooglo.ads and s-pooloc.ads for full details on the default pools used.

See documentation in the sources of the run time mentioned in the previous paragraph. All these pools are accessible by means of with'ing these units.

Storage_Size is measured in storage units, and refers to the total space available for an access type collection, or to the primary stack space for a task.

See documentation in the sources of the run time mentioned in the paragraph about standard storage pools above for details on GNAT-defined aspects of storage pools.

See Standard and Implementation Defined Restrictions.

Restrictions that can be checked at compile time result in illegalities if violated. Currently there are no other consequences of violating restrictions.

The representation is the in-memory representation of the base type of the type, using the number of bits corresponding to the type'Size value, and the natural ordering of the machine.

See items describing the integer and floating-point types supported.

Ada.Wide_Characters.Handling.Character_Set_Version returns the string "Unicode 4.0", referring to version 4.0 of the Unicode specification.

The elementary functions correspond to the functions available in the C library. Only fast math mode is implemented.

The sign of zeroes follows the requirements of the IEEE 754 standard on floating-point.

Maximum image width is 6864, see library file s-rannum.ads.

Maximum image width is 6864, see library file s-rannum.ads.

The algorithm is the Mersenne Twister, as documented in the source file s-rannum.adb. This version of the algorithm has a period of 2**19937-1.

The value returned by the Image function is the concatenation of the fixed-width decimal representations of the 624 32-bit integers of the state vector.

The minimum period between reset calls to guarantee distinct series of random numbers is one microsecond.

Run the compiler with `-gnatS' to produce a listing of package Standard, has the values of all numeric attributes.

There are no special implementation defined characteristics for these packages.

All type representations are contiguous, and the Buffer_Size is the value of type'Size rounded up to the next storage unit boundary.

These files are mapped onto the files provided by the C streams libraries. See source file i-cstrea.ads for further details.

If more digits are requested in the output than are represented by the precision of the value, zeroes are output in the corresponding least significant digit positions.

These are mapped onto the argv and argc parameters of the main program in the natural manner.

The Form parameter is not used.

The Form parameter is not used.

The Form parameter is case-insensitive. Two fields are recognized in the Form parameter:

    *preserve=<value>*
    *mode=<value>*

<value> starts immediately after the character '=' and ends with the character immediately preceding the next comma (',') or with the last character of the parameter.

The only possible values for preserve= are:

Value

Meaning


`no_attributes'

Do not try to preserve any file attributes. This is the default if no preserve= is found in Form.


`all_attributes'

Try to preserve all file attributes (timestamps, access rights).


`timestamps'

Preserve the timestamp of the copied file, but not the other file attributes.

The only possible values for mode= are:

Value

Meaning


`copy'

Only do the copy if the destination file does not already exist. If it already exists, Copy_File fails.


`overwrite'

Copy the file in all cases. Overwrite an already existing destination file.


`append'

Append the original file to the destination file. If the destination file does not exist, the destination file is a copy of the source file. When mode=append, the field preserve=, if it exists, is not taken into account.

If the Form parameter includes one or both of the fields and the value or values are incorrect, Copy_file fails with Use_Error.

Examples of correct Forms:

    Form => "preserve=no_attributes,mode=overwrite" (the default)
    Form => "mode=append"
    Form => "mode=copy, preserve=all_attributes"

Examples of incorrect Forms:

    Form => "preserve=junk"
    Form => "mode=internal, preserve=timestamps"

When the Pattern parameter is not the null string, it is interpreted according to the syntax of regular expressions as defined in the GNAT.Regexp package.

See GNAT.Regexp (g-regexp.ads).

The following convention names are supported

Convention Name

Interpretation


`Ada'

Ada


`Ada_Pass_By_Copy'

Allowed for any types except by-reference types such as limited records. Compatible with convention Ada, but causes any parameters with this convention to be passed by copy.


`Ada_Pass_By_Reference'

Allowed for any types except by-copy types such as scalars. Compatible with convention Ada, but causes any parameters with this convention to be passed by reference.


`Assembler'

Assembly language


`Asm'

Synonym for Assembler


`Assembly'

Synonym for Assembler


`C'

C


`C_Pass_By_Copy'

Allowed only for record types, like C, but also notes that record is to be passed by copy rather than reference.


`COBOL'

COBOL


`C_Plus_Plus (or CPP)'

C++


`Default'

Treated the same as C


`External'

Treated the same as C


`Fortran'

Fortran


`Intrinsic'

For support of pragma Import with convention Intrinsic, see separate section on Intrinsic Subprograms.


`Stdcall'

Stdcall (used for Windows implementations only). This convention correspond to the WINAPI (previously called Pascal convention) C/C++ convention under Windows. A routine with this convention cleans the stack before exit. This pragma cannot be applied to a dispatching call.


`DLL'

Synonym for Stdcall


`Win32'

Synonym for Stdcall


`Stubbed'

Stubbed is a special convention used to indicate that the body of the subprogram will be entirely ignored. Any call to the subprogram is converted into a raise of the Program_Error exception. If a pragma Import specifies convention stubbed then no body need be present at all. This convention is useful during development for the inclusion of subprograms whose body has not yet been written. In addition, all otherwise unrecognized convention names are also treated as being synonymous with convention C. In all implementations except for VMS, use of such other names results in a warning. In VMS implementations, these names are accepted silently.

Link names are the actual names used by the linker.

The default linker name is that which would be assigned by the relevant external language, interpreting the Ada name as being in all lower case letters.

The string passed to Linker_Options is presented uninterpreted as an argument to the link command, unless it contains ASCII.NUL characters. NUL characters if they appear act as argument separators, so for example

    pragma Linker_Options ("-labc" & ASCII.NUL & "-ldef");

causes two separate arguments -labc and -ldef to be passed to the linker. The order of linker options is preserved for a given unit. The final list of options passed to the linker is in reverse order of the elaboration order. For example, linker options for a body always appear before the options from the corresponding package spec.

See files with prefix i- in the distributed library.

See files with prefix i- in the distributed library.

COBOL

Ada


`Floating'

Float


`Long_Floating'

(Floating) Long_Float


`Binary'

Integer


`Long_Binary'

Long_Long_Integer


`Decimal_Element'

Character


`COBOL_Character'

Character

For initialization, see the file i-cobol.ads in the distributed library.

See documentation in file s-maccod.ads in the distributed library.

See documentation in file s-maccod.ads in the distributed library.

Interrupts are mapped to signals or conditions as appropriate. See definition of unit Ada.Interrupt_Names in source file a-intnam.ads for details on the interrupts supported on a particular target.

GNAT does not permit a partition to be restarted without reloading, except under control of the debugger.

Pragma Discard_Names causes names of enumeration literals to be suppressed. In the presence of this pragma, the Image attribute provides the image of the Pos of the literal, and Value accepts Pos values.

The result of this attribute is a string that identifies the object or component that denotes a given task. If a variable Var has a task type, the image for this task will have the form Var_`XXXXXXXX`, where the suffix is the hexadecimal representation of the virtual address of the corresponding task control block. If the variable is an array of tasks, the image of each task will have the form of an indexed component indicating the position of a given task in the array, e.g., Group(5)_`XXXXXXX`. If the task is a component of a record, the image of the task will have the form of a selected component. These rules are fully recursive, so that the image of a task that is a subcomponent of a composite object corresponds to the expression that designates this task.

If a task is created by an allocator, its image depends on the context. If the allocator is part of an object declaration, the rules described above are used to construct its image, and this image is not affected by subsequent assignments. If the allocator appears within an expression, the image includes only the name of the task type.

If the configuration pragma Discard_Names is present, or if the restriction No_Implicit_Heap_Allocation is in effect, the image reduces to the numeric suffix, that is to say the hexadecimal representation of the virtual address of the control block of the task.

Protected entries or interrupt handlers can be executed by any convenient thread, so the value of Current_Task is undefined.

The effect of calling Current_Task from an entry body or interrupt handler is to return the identification of the task currently executing the code.

There are no implementation-defined aspects of Task_Attributes.

The metrics information for GNAT depends on the performance of the underlying operating system. The sources of the run-time for tasking implementation, together with the output from `-gnatG' can be used to determine the exact sequence of operating systems calls made to implement various tasking constructs. Together with appropriate information on the performance of the underlying operating system, on the exact target in use, this information can be used to determine the required metrics.

See declarations in file system.ads.

There are no implementation-defined execution resources.

On a multi-processor, a task that is waiting for access to a protected object does not keep its processor busy.

Tasks map to threads in the threads package used by GNAT. Where possible and appropriate, these threads correspond to native threads of the underlying operating system.

There are no implementation-defined policy-identifiers allowed in this pragma.

Execution of a task cannot be preempted by the implementation processing of delay expirations for lower priority tasks.

The policy is the same as that of the underlying threads implementation.

The two implementation defined policies permitted in GNAT are Inheritance_Locking and Conccurent_Readers_Locking. On targets that support the Inheritance_Locking policy, locking is implemented by inheritance, i.e., the task owning the lock operates at a priority equal to the highest priority of any task currently requesting the lock. On targets that support the Conccurent_Readers_Locking policy, locking is implemented with a read/write lock allowing multiple propected object functions to enter concurrently.

The ceiling priority of protected objects of the type System.Interrupt_Priority'Last as described in the Ada Reference Manual D.3(10),

The ceiling priority of internal protected objects is System.Priority'Last.

There are no implementation-defined queuing policies.

The semantics for abort on a multi-processor is the same as on a single processor, there are no further delays.

The only operation that implicitly requires heap storage allocation is task creation.

Execution is erroneous in that case.

There are no such implementation-defined aspects.

There are no implementation defined aspects of package Real_Time.

Any difference greater than one microsecond will cause the task to be delayed (see D.9(7)).

The upper bound is determined by the underlying operating system. In no cases is it more than 10 milliseconds.

The GLADE package provides a utility GNATDIST for creating and executing distributed programs. See the GLADE reference manual for further details.

See the GLADE reference manual for full details on such events.

See the GLADE reference manual for full details on these aspects of multi-partition execution.

Editing the source file of a compilation unit, or the source files of any units on which it is dependent in a significant way cause the version to change. No other actions cause the version number to change. All changes are significant except those which affect only layout, capitalization or comments.

See the GLADE reference manual for details on the effect of abort in a distributed application.

See the GLADE reference manual for a full description of all implementation defined aspects of the PCS.

See the GLADE reference manual for a full description of all implementation defined interfaces.

Named Number

Value


`Max_Scale'

+18


`Min_Scale'

-18


`Min_Delta'

1.0E-18


`Max_Delta'

1.0E+18


`Max_Decimal_Digits'

18

64

64

Standard library functions are used for the complex arithmetic operations. Only fast math mode is currently supported.

The signs of zero values are as recommended by the relevant implementation advice.

The signs of zero values are as recommended by the relevant implementation advice.

The strict mode is the default. There is no separate relaxed mode. GNAT provides a highly efficient implementation of strict mode.

For cases where the result interval is implementation dependent, the accuracy is that provided by performing all operations in 64-bit IEEE floating-point format.

Infinite and NaN values are produced as dictated by the IEEE floating-point standard. Note that on machines that are not fully compliant with the IEEE floating-point standard, such as Alpha, the `-mieee' compiler flag must be used for achieving IEEE conforming behavior (although at the cost of a significant performance penalty), so infinite and NaN values are properly generated.

Not relevant, division is IEEE exact.

Operations in the close result set are performed using IEEE long format floating-point arithmetic. The input operands are converted to floating-point, the operation is done in floating-point, and the result is converted to the target type.

The result is only defined to be in the perfect result set if the result can be computed by a single scaling operation involving a scale factor representable in 64-bits.

Not relevant, Machine_Overflows is True for fixed-point types.

IEEE infinite and Nan values are produced as appropriate.

Information on this subject is not yet available.

Information on this subject is not yet available.

IEEE infinite and Nan values are produced as appropriate.

Information on those subjects is not yet available.

Information on this subject is not yet available.

Pragma Inspection_Point ensures that the variable is live and can be examined by the debugger at the inspection point.

There are no implementation-defined aspects of pragma Restrictions. The use of pragma Restrictions [No_Exceptions] has no effect on the generated code. Checks must suppressed by use of pragma Suppress.

There are no restrictions on pragma Restrictions.