6.3.1 Conformance Rules
subprogram profiles are given in more than one place, they are required
to conform in one of four ways: type conformance, mode conformance, subtype
conformance, or full conformance.
explained in B.1
”, a convention
can be specified for an entity.
Unless this International Standard states otherwise, the default convention
of an entity is Ada. For a callable entity or access-to-subprogram type,
the convention is called the calling convention
. The following
conventions are defined by the language:
calling convention for any subprogram not listed below is Ada
The Convention aspect may be specified to override the default calling
convention (see B.1
calling convention represents subprograms that are “built
in” to the compiler. The default calling convention is Intrinsic
for the following:
an enumeration literal;
a "/=" operator declared
implicitly due to the declaration of "=" (see 6.6
any other implicitly declared subprogram
unless it is a dispatching operation of a tagged type;
an inherited subprogram of a generic
formal tagged type with unknown discriminants;
an attribute that is a subprogram;
any prefixed view of a subprogram
) without synchronization kind
) By_Entry or By_Protected_Procedure.
The Access attribute is not allowed for
calling convention is protected
for a protected subprogram, for
a prefixed view of a subprogram with a synchronization kind of By_Protected_Procedure,
and for an access-to-subprogram type with the reserved word protected
in its definition.
calling convention is entry
for an entry and for a prefixed view
of a subprogram with a synchronization kind of By_Entry.
The calling convention for an anonymous access-to-subprogram
parameter or anonymous access-to-subprogram result is protected
if the reserved word protected appears in its definition; otherwise,
it is the convention of the subprogram that contains the parameter.
If not specified above as Intrinsic, the calling
convention for any inherited or overriding dispatching operation of a
tagged type is that of the corresponding subprogram of the parent type.
The default calling convention for a new dispatching operation of a tagged
type is the convention of the type.
Of these four conventions, only Ada and Intrinsic
are allowed as a convention_identifier
in the specification of a Convention aspect.
are type conformant
if they have the same number of parameters,
and both have a result if either does, and corresponding parameter and
result types are the same, or, for access parameters or access results,
corresponding designated types are the same, or corresponding designated
profiles are type conformant.
profiles are mode conformant
they are type conformant; and
corresponding parameters have identical modes and
both or neither are explicitly aliased parameters; and
for corresponding access parameters and any access
result type, the designated subtypes statically match and either both
or neither are access-to-constant, or the designated profiles are subtype
are subtype conformant
if they are mode conformant, corresponding
subtypes of the profile statically match, and the associated calling
conventions are the same. The profile of a generic formal subprogram
is not subtype conformant with any other profile.
profiles are fully conformant
if they are subtype conformant,
if they have access-to-subprogram results whose designated profiles are
fully conformant, and for corresponding parameters:
they have the same names; and
for access-to-subprogram parameters, the designated
profiles are fully conformant.
expressions are fully conformant
if, after replacing each use
of an operator with the equivalent function_call
each constituent construct of one corresponds to
an instance of the same syntactic category in the other, except that
an expanded name may correspond to a direct_name
or to a different expanded name in the other; and
that is a literal in one has the same value as the corresponding literal
in the other.
are fully conformant
if they have the same number of discriminants,
and discriminants in the same positions have the same names, statically
matching subtypes, and default_expression
that are fully conformant with one another.
The prefixed view profile
of a subprogram is the profile obtained by omitting the first parameter
of that subprogram. There is no prefixed view profile for a parameterless
subprogram. For the purposes of defining subtype and mode conformance,
the convention of a prefixed view profile is considered to match that
of either an entry or a protected operation.
An implementation may declare an operator declared
in a language-defined library unit to be intrinsic.
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe