J.15.1 Pragma Inline
Syntax
1/3
2/3
Legality Rules
3/3
{
AI05-0229-1}
The pragma
shall apply to one or more callable entities or generic subprograms.
Static Semantics
4/3
4.a/3
Ramification:
Note that inline expansion is desired no matter what name
is used in the call. This allows one to request inlining for only one
of several overloaded subprograms as follows:
4.b/3
package IO is
procedure Put(X : in Integer);
procedure Put(X : in String);
procedure Put(X : in Character);
private
procedure Character_Put(X : in Character) renames Put;
pragma Inline(Character_Put);
end IO;
4.c/3
with IO; use IO;
procedure Main is
I : Integer;
C : Character;
begin
...
Put(C); -- Inline expansion is desired.
Put(I); -- Inline expansion is NOT desired.
end Main;
Implementation Permissions
5/3
5.a/3
Reason: This is
allowed for Ada 83 compatibility. This is only a permission as this usage
was considered obsolescent even for Ada 95.
5.b/3
6/3
4 {
AI05-0229-1}
The name in a pragma
Inline may denote more than one entity in the case of overloading. Such
a pragma applies
to all of the denoted entities.
Incompatibilities With Ada 83
6.a/3
{
AI95-00309-01}
{
AI05-0229-1}
A pragma Inline cannot refer
to a subprogram_body
outside of that body. The pragma can be given inside of the subprogram
body. Ada 2005 adds an Implementation Permission to allow this usage
for compatibility (and Ada 95 implementations also can use this permission),
but implementations do not have to allow such pragmas.
Extensions to Ada 83
6.b/3
Extensions to Ada 95
6.c/3
Wording Changes from Ada 2005
6.d/3
{
AI05-0229-1}
This clause is new. Pragma Inline was moved here
from 6.3.2; aspect Inline lives there now.
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe