Annotated Ada Reference ManualLegal Information
Contents   Index   References   Search   Previous   Next 

6.2 Formal Parameter Modes

1
[A parameter_specification declares a formal parameter of mode in, in out, or out.]

Static Semantics

2
A parameter is passed either by copy or by reference. [When a parameter is passed by copy, the formal parameter denotes a separate object from the actual parameter, and any information transfer between the two occurs only before and after executing the subprogram. When a parameter is passed by reference, the formal parameter denotes (a view of) the object denoted by the actual parameter; reads and updates of the formal parameter directly reference the actual parameter object.]
3/3
{AI05-0142-4} {AI05-0262-1} A type is a by-copy type if it is an elementary type, or if it is a descendant of a private type whose full type is a by-copy type. A parameter of a by-copy type is passed by copy, unless the formal parameter is explicitly aliased.
4
A type is a by-reference type if it is a descendant of one of the following: 
5
a tagged type;
6
a task or protected type;
7/3
{AI05-0096-1} an explicitly limited record type; 
7.a/3
This paragraph was deleted.{AI05-0096-1}
8
a composite type with a subcomponent of a by-reference type;
9
a private type whose full type is a by-reference type. 
10/3
 {AI05-0142-4} {AI05-0188-1} A parameter of a by-reference type is passed by reference, as is an explicitly aliased parameter of any type. Each value of a by-reference type has an associated object. For a parenthesized expression, qualified_expression, or type_conversion, this object is the one associated with the operand. For a conditional_expression, this object is the one associated with the evaluated dependent_expression.
10.a
Ramification: By-reference parameter passing makes sense only if there is an object to reference; hence, we define such an object for each case.
10.b
Since tagged types are by-reference types, this implies that every value of a tagged type has an associated object. This simplifies things, because we can define the tag to be a property of the object, and not of the value of the object, which makes it clearer that object tags never change.
10.c
We considered simplifying things even more by making every value (and therefore every expression) have an associated object. After all, there is little semantic difference between a constant object and a value. However, this would cause problems for untagged types. In particular, we would have to do a constraint check on every read of a type conversion (or a renaming thereof) in certain cases.
10.d/2
{AI95-00318-02} We do not want this definition to depend on the view of the type; privateness is essentially ignored for this definition. Otherwise, things would be confusing (does the rule apply at the call site, at the site of the declar .rved word may be in upper case. 
2.a
Discussion: Reserved words have special meaning in the syntax. In addition, certain reserved words are used as attribute names.
2.b
The syntactic category identifier no longer allows reserved words. We have added the few reserved words that are legal explicitly to the syntax for attribute_reference. Allowing identifier to include reserved words has been a source of confusion for some users, and differs from the way they are treated in the C and Pascal language definitions. 
abortelsenewreturn
abselsifnotreverse
abstractendnull 
acceptentry select
accessexceptionofseparate
aliasedexitorsome
all otherssubtype
andforoutsynchronized
arrayfunctionoverriding 
at  tagged
 genericpackagetask
begingotopragmaterminate
body privatethen
 ifproceduretype
caseinprotected 
constantinterface until
 israiseuse
declare range 
delaylimitedrecordwhen
deltaloopremwhile
digits renameswith
domodrequeue 
   xor
NOTES
3
7  The reserved words appear in lower case boldface in this International Standard, except when used in the designator of an attribute (see 4.1.4). Lower case boldface is also used for a reserved word in a string_literal used as an operator_symbol. This is merely a convention — programs may be written in whatever typeface is desired and available. 

Incompatibilities With Ada 83

3.a
The following words are not reserved in Ada 83, but are reserved in Ada 95: abstract, aliased, protected, requeue, tagged, until.

Wording Changes from Ada 83

3.b
The clause entitled “Allowed Replacements of Characters” has been moved to Annex J, “Obsolescent Features”. 

Incompatibilities With Ada 95

3.c/2
{AI95-00284-02} The following words are not reserved in Ada 95, but are reserved in Ada 2005: interface, overriding, synchronized. A special allowance is made for pragma Interface (see J.12). Uses of these words as identifiers will need to be changed, but we do not expect them to be common. 

Wording Changes from Ada 95

3.d/2
{AI95-00395-01} The definition of upper case equivalence has been modified to allow identifiers using all of the characters of ISO 10646. This change has no effect on the character sequences that are reserved words, but does make some unusual sequences of characters illegal. 

Incompatibilities With Ada 2005

3.e/3
{AI05-0091-1} Correction: Removed other_format characters from reserved words in order to be compatible with the latest Unicode recommendations. This change can only affect programs written for original Ada 2005, and there is little reason to put other_format characters into reserved words in the first place, so there should be very few such programs.
3.f/3
{AI05-0176-1} The following word is not reserved in Ada 2005, but is reserved in Ada 2012: some. Uses of this word as an identifier will need to be changed, but we do not expect them to be common. 

Contents   Index   References   Search   Previous   Next 
Ada-Europe Ada 2005 and 2012 Editions sponsored in part by Ada-Europe
./usr/share/doc/ada-reference-manual-2012/aarm2012-html/AA-6-2.html0000644000000000000000000004667511765323002022570 0ustar rootroot Formal Parameter Modes
Annotated Ada Reference ManualLegal Information
Contents   Index   References   Search   Previous   Next 

6.2 Formal Parameter Modes

1
[A parameter_specification declares a formal parameter of mode in, in out, or out.]

Static Semantics

2
A parameter is passed either by copy or by reference. [When a parameter is passed by copy, the formal parameter denotes a separate object from the actual parameter, and any information transfer between the two occurs only before and after executing