File: AA-10-2-1.html

package info (click to toggle)
ada-reference-manual 20021112web-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny, sarge
  • size: 18,652 kB
  • ctags: 8,921
  • sloc: makefile: 52; sh: 20
file content (415 lines) | stat: -rw-r--r-- 29,288 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
    <TITLE>AARM95 - Elaboration Control</TITLE>
    <META NAME="Author" CONTENT="JTC1/SC22/WG9/ARG, by Randall Brukardt, ARG Editor">
    <META NAME="GENERATOR" CONTENT="Arm_Form.Exe, Ada Reference Manual generator">
    <STYLE type="text/css">
    DIV.paranum {position: absolute; font-family: Arial, Helvetica, sans-serif; left: 0.5 em; top: auto}
    TT {font-family: "Courier New", monospace}
    DT {display: compact}
    DIV.Normal {font-family: "Times New Roman", Times, serif; margin-bottom: 0.6em}
    DIV.Wide {font-family: "Times New Roman", Times, serif; margin-top: 0.6em; margin-bottom: 0.6em}
    DIV.Annotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
    DIV.WideAnnotations {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0.6em; margin-bottom: 0.6em}
    DIV.Index {font-family: "Times New Roman", Times, serif}
    DIV.SyntaxSummary {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
    DIV.Notes {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.6em}
    DIV.NotesHeader {font-family: "Times New Roman", Times, serif; margin-left: 2.0em}
    DIV.SyntaxIndented {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-bottom: 0.4em}
    DIV.Indented {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-bottom: 0.6em}
    DIV.CodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-bottom: 0.6em}
    DIV.SmallIndented {font-family: "Times New Roman", Times, serif; margin-left:  10.0em; margin-bottom: 0.6em}
    DIV.SmallCodeIndented {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-bottom: 0.6em}
    DIV.Examples {font-family: "Courier New", monospace; margin-left: 2.0em; margin-bottom: 0.6em}
    DIV.SmallExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left: 7.5em; margin-bottom: 0.6em}
    DIV.IndentedExamples {font-family: "Courier New", monospace; margin-left: 8.0em; margin-bottom: 0.6em}
    DIV.SmallIndentedExamples {font-family: "Courier New", monospace; font-size: 80%; margin-left:  15.0em; margin-bottom: 0.6em}
    UL.Bulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SmallBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SmallNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.IndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.CodeIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.CodeIndentedNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-right: 8.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.SyntaxIndentedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NotesBulleted {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    UL.NotesNestedBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    DL.Hanging {font-family: "Times New Roman", Times, serif; margin-top: 0em; margin-bottom: 0.6em}
    DD.Hanging {margin-left: 6.0em}
    DL.IndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.IndentedHanging {margin-left: 2.0em}
    DL.HangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.HangingInBulleted {margin-left: 4.0em}
    DL.SmallHanging {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.SmallHanging {margin-left: 7.5em}
    DL.SmallIndentedHanging {font-family: "Times New Roman", Times, serif; margin-left: 8.0em; margin-top: 0em; margin-bottom: 0.6em}
    DD.SmallIndentedHanging {margin-left: 2.0em}
    DL.SmallHangingInBulleted {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.SmallHangingInBulleted {margin-left: 5.0em}
    DL.Enumerated {font-family: "Times New Roman", Times, serif; margin-right: 0.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.Enumerated {margin-left: 2.0em}
    DL.SmallEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 4.0em; margin-right: 4.0em; margin-top: 0em; margin-bottom: 0.5em}
    DD.SmallEnumerated {margin-left: 2.5em}
    DL.NestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 2.0em; margin-right: 2.0em; margin-top: 0em; margin-bottom: 0.5em}
    DL.SmallNestedEnumerated {font-family: "Times New Roman", Times, serif; margin-left: 6.0em; margin-right: 6.0em; margin-top: 0em; margin-bottom: 0.5em}
    </STYLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFF0" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<P><A HREF="AA-TOC.html">Contents</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-0-29.html">Index</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-10-2.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-11.html">Next</A></P>
<HR>
<H1> 10.2.1 Elaboration Control</H1>
<DIV Class="Paranum"><FONT SIZE=-2>1</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;[<A NAME="I3984"></A> This subclause defines pragmas
that help control the elaboration order of <FONT FACE="Arial, Helvetica">library_item</FONT>s.]
</DIV>

<H4 ALIGN=CENTER>Language Design Principles</H4>
<DIV Class="Paranum"><FONT SIZE=-2>1.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The rules governing preelaboration
are designed to allow it to be done largely by bulk initialization of
statically allocated storage from information in a ``load module'' created
by a linker. Some implementations may require run-time code to be executed
in some cases, but we consider these cases rare enough that we need not
further complicate the rules.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>1.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>It is important that programs
be able to declare data structures that are link-time initialized with
<FONT FACE="Arial, Helvetica">aggregate</FONT>s, <FONT FACE="Arial, Helvetica">string_literal</FONT>s,
and concatenations thereof. It is important to be able to write link-time
evaluated expressions involving the First, Last, and Length attributes
of such data structures (including variables), because they might be
initialized with positional <FONT FACE="Arial, Helvetica">aggregate</FONT>s
or <FONT FACE="Arial, Helvetica">string_literal</FONT>s, and we don't
want the user to have to count the elements. There is no corresponding
need for accessing discriminants, since they can be initialized with
a static constant, and then the constant can be referred to elsewhere.
It is important to allow link-time initialized data structures involving
discriminant-dependent components. It is important to be able to write
link-time evaluated expressions involving pointers (both access values
and addresses) to the above-mentioned data structures.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>1.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The rules also ensure that no
Elaboration_Check need be performed for calls on library-level subprograms
declared within a preelaborated package. This is true also of the Elaboration_Check
on task activation for library level task types declared in a preelaborated
package. However, it is not true of the Elaboration_Check on instantiations.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>1.d</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>A static expression should never
prevent a library unit from being preelaborable.</FONT></DIV>

<H4 ALIGN=CENTER>Syntax</H4>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="SyntaxIndented" Style="margin-bottom: 0.2em">The form of
a <FONT FACE="Arial, Helvetica">pragma</FONT> Preelaborate is as follows:
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DIV Class="SyntaxIndented">&nbsp;&nbsp;<B>pragma</B> <A NAME="I3985"></A>Preelaborate[(<I>library_unit_</I><A NAME="I3986"></A><FONT FACE="Arial, Helvetica">name</FONT>)];</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<DIV Class="SyntaxIndented"><A NAME="I3987"></A><A NAME="I3988"></A>A
<FONT FACE="Arial, Helvetica">pragma</FONT> Preelaborate is a library
unit pragma. </DIV>

<H4 ALIGN=CENTER>Legality Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>5</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em">&nbsp;&nbsp;&nbsp;<A NAME="I3989"></A>An
elaborable construct is preelaborable unless its elaboration performs
any of the following actions: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>A <I>preelaborable</I>
construct can be elaborated without using any information that is available
only at run time. Note that we don't try to prevent exceptions in preelaborable
constructs; if the implementation wishes to generate code to raise an
exception, that's OK.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Because there is no flow of control
and there are no calls (other than to predefined subprograms), these
run-time properties can actually be detected at compile time. This is
necessary in order to require compile-time enforcement of the rules.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The execution of a <FONT FACE="Arial, Helvetica">statement</FONT>
other than a <FONT FACE="Arial, Helvetica">null_statement</FONT>. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>6.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>A preelaborable
construct can contain <FONT FACE="Arial, Helvetica">label</FONT>s and
<FONT FACE="Arial, Helvetica">null_statement</FONT>s. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>A call to a subprogram other than a static function.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The evaluation of a <FONT FACE="Arial, Helvetica">primary</FONT>
that is a <FONT FACE="Arial, Helvetica">name</FONT> of an object, unless
the <FONT FACE="Arial, Helvetica">name</FONT> is a static expression,
or statically denotes a discriminant of an enclosing type. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>One can evaluate
such a <FONT FACE="Arial, Helvetica">name</FONT>, but not as a <FONT FACE="Arial, Helvetica">primary</FONT>.
For example, one can evaluate an attribute of the object. One can evaluate
an <FONT FACE="Arial, Helvetica">attribute_reference</FONT>, so long
as it does not denote an object, and its <FONT FACE="Arial, Helvetica">prefix</FONT>
does not disobey any of these rules. For example, Obj'Access, Obj'Unchecked_Access,
and Obj'Address are generally legal in preelaborated library units. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The creation of a default-initialized object [(including
a component)] of a descendant of a private type, private extension, controlled
type, task type, or protected type with <FONT FACE="Arial, Helvetica">entry_declaration</FONT>s;
similarly the evaluation of an <FONT FACE="Arial, Helvetica">extension_aggregate</FONT>
with an ancestor <FONT FACE="Arial, Helvetica">subtype_mark</FONT> denoting
a subtype of such a type. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>9.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>One can declare
these kinds of types, but one cannot create objects of those types.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>It is also non-preelaborable to
create an object if that will cause the evaluation of a default expression
that will call a user-defined function. This follows from the rule above
forbidding non-null statements. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>Controlled objects
are disallowed because most implementations will have to take some run-time
action during initialization, even if the Initialize procedure is null.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;A generic body is preelaborable only if elaboration
of a corresponding instance body would not perform any such actions,
presuming that the actual for each formal private type (or extension)
is a private type (or extension), and the actual for each formal subprogram
is a user-defined subprogram. <A NAME="I3990"></A></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>Without this rule
about generics, we would have to forbid instantiations in preelaborated
library units, which would significantly reduce their usefulness. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11/1</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<I><A HREF="defect1.html#8652/0035">8652/0035</A></I>}
<A NAME="I3991"></A>If a <FONT FACE="Arial, Helvetica">pragma</FONT>
Preelaborate (or <FONT FACE="Arial, Helvetica">pragma</FONT> Pure --
see below) applies to a library unit, then it is <I>preelaborated</I>.
[ <A NAME="I3992"></A>If a library unit is preelaborated, then its declaration,
if any, and body, if any, are elaborated prior to all non-preelaborated
<FONT FACE="Arial, Helvetica">library_item</FONT>s of the partition.]
<U>The declaration and body of a preelaborated library unit, and all
subunits that are elaborated as part of elaborating the library unit,</U><S>All
compilation units of a preelaborated library unit</S> shall be preelaborable.
<A NAME="I3993"></A>In addition to the places where Legality Rules normally
apply (see <A HREF="AA-12-3.html">12.3</A>), this rule applies also in
the private part of an instance of a generic unit. In addition, all compilation
units of a preelaborated library unit shall depend semantically only
on compilation units of other preelaborated library units. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>In a generic
body, we assume the worst about formal private types and extensions.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11.a.1/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>{<I><A HREF="defect1.html#8652/0035">8652/0035</A></I>}
<U>Subunits of a preelaborated subprogram unit do not need to be preelaborable.
This is needed in order to be consistent with units nested in a subprogram
body, which do not need to be preelaborable even if the subprogram is
preelaborated. However, such subunits cannot depend semantically on non-preelaborated
units, which is also consistent with nested units.</U> </FONT></DIV>

<H4 ALIGN=CENTER>Implementation Advice</H4>
<DIV Class="Paranum"><FONT SIZE=-2>12</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;In an implementation, a type declared in a preelaborated
package should have the same representation in every elaboration of a
given version of the package, whether the elaborations occur in distinct
executions of the same program, or in executions of distinct programs
or partitions that include the given version. </DIV>

<H4 ALIGN=CENTER>Syntax</H4>
<DIV Class="Paranum"><FONT SIZE=-2>13</FONT></DIV>
<DIV Class="SyntaxIndented" Style="margin-bottom: 0.2em">The form of
a <FONT FACE="Arial, Helvetica">pragma</FONT> Pure is as follows: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14</FONT></DIV>
<DIV Class="SyntaxIndented">&nbsp;&nbsp;<B>pragma</B> <A NAME="I3994"></A>Pure[(<I>library_unit_</I><A NAME="I3995"></A><FONT FACE="Arial, Helvetica">name</FONT>)];</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>15</FONT></DIV>
<DIV Class="SyntaxIndented"><A NAME="I3996"></A><A NAME="I3997"></A>A
<FONT FACE="Arial, Helvetica">pragma</FONT> Pure is a library unit pragma.
</DIV>

<H4 ALIGN=CENTER>Legality Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>16</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I3998"></A>A <I>pure</I> <FONT FACE="Arial, Helvetica">library_item</FONT>
is a preelaborable <FONT FACE="Arial, Helvetica">library_item</FONT>
that does not contain the declaration of any variable or named access
type, except within a subprogram, generic subprogram, task unit, or protected
unit.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>17</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I3999"></A>A <FONT FACE="Arial, Helvetica">pragma</FONT>
Pure is used to declare that a library unit is pure. If a <FONT FACE="Arial, Helvetica">pragma</FONT>
Pure applies to a library unit, then its compilation units shall be pure,
and they shall depend semantically only on compilation units of other
library units that are declared pure. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>17.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>To be honest: </B>A <I>declared-pure</I>
library unit is one to which a <FONT FACE="Arial, Helvetica">pragma</FONT>
Pure applies. Its declaration and body are also said to be declared pure.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>17.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>A declared-pure
package is useful for defining types to be shared between partitions
with no common address space. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>17.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>Note that generic
packages are not mentioned in the list of things that can contain variable
declarations. Note that the Ada 95 rules for deferred constants make
them allowable in library units that are declared pure; that isn't true
of Ada 83's deferred constants. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>17.d</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>Anonymous
access types (that is, access discriminants and access parameters) are
allowed. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>17.e</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>The primary reason
for disallowing named access types is that an <FONT FACE="Arial, Helvetica">allocator</FONT>
has a side effect; the pool constitutes variable data. We considered
somehow allowing <FONT FACE="Arial, Helvetica">allocator</FONT>-less
access types. However, these (including access-to-subprogram types) would
cause trouble for <A HREF="AA-E.html">Annex E</A>, ``<A HREF="AA-E.html">Distributed
Systems</A>'', because such types would allow access values in a shared
passive partition to designate objects in an active partition, thus allowing
inter-address space references. Furthermore, a named access-to-object
type without a pool would be a new concept, adding complexity from the
user's point of view. Finally, the prevention of <FONT FACE="Arial, Helvetica">allocator</FONT>s
would have to be a run-time check, in order to avoid violations of the
generic contract model. </FONT></DIV>

<H4 ALIGN=CENTER>Implementation Permissions</H4>
<DIV Class="Paranum"><FONT SIZE=-2>18</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;If a library unit is declared pure, then the
implementation is permitted to omit a call on a library-level subprogram
of the library unit if the results are not needed after the call. Similarly,
it may omit such a call and simply reuse the results produced by an earlier
call on the same subprogram, provided that none of the parameters are
of a limited type, and the addresses and values of all by-reference actual
parameters, and the values of all by-copy-in actual parameters, are the
same as they were at the earlier call. [This permission applies even
if the subprogram produces other side effects when called.] </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>18.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>A declared-pure
<FONT FACE="Arial, Helvetica">library_item</FONT> has no variable state.
Hence, a call on one of its (nonnested) subprograms cannot ``normally''
have side effects. The only possible side effects from such a call would
be through machine code insertions, unchecked conversion to an access
type declared within the subprogram, and similar features. The compiler
may omit a call to such a subprogram even if such side effects exist,
so the writer of such a subprogram has to keep this in mind. </FONT></DIV>

<H4 ALIGN=CENTER>Syntax</H4>
<DIV Class="Paranum"><FONT SIZE=-2>19</FONT></DIV>
<DIV Class="SyntaxIndented" Style="margin-bottom: 0.2em">The form of
a <FONT FACE="Arial, Helvetica">pragma</FONT> Elaborate, Elaborate_All,
or Elaborate_Body is as follows: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>20</FONT></DIV>
<DIV Class="SyntaxIndented">&nbsp;&nbsp;<B>pragma</B> <A NAME="I4000"></A>Elaborate(<I>library_unit_</I><A NAME="I4001"></A><FONT FACE="Arial, Helvetica">name</FONT>{,
<I>library_unit_</I><A NAME="I4002"></A><FONT FACE="Arial, Helvetica">name</FONT>});</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>21</FONT></DIV>
<DIV Class="SyntaxIndented">&nbsp;&nbsp;<B>pragma</B> <A NAME="I4003"></A>Elaborate_All(<I>library_unit_</I><A NAME="I4004"></A><FONT FACE="Arial, Helvetica">name</FONT>{,
<I>library_unit_</I><A NAME="I4005"></A><FONT FACE="Arial, Helvetica">name</FONT>});</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>22</FONT></DIV>
<DIV Class="SyntaxIndented">&nbsp;&nbsp;<B>pragma</B> <A NAME="I4006"></A>Elaborate_Body[(<I>library_unit_</I><A NAME="I4007"></A><FONT FACE="Arial, Helvetica">name</FONT>)];</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>23</FONT></DIV>
<DIV Class="SyntaxIndented">A <FONT FACE="Arial, Helvetica">pragma</FONT>
Elaborate or Elaborate_All is only allowed within a <FONT FACE="Arial, Helvetica">context_clause</FONT>.
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>23.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>``Within
a <FONT FACE="Arial, Helvetica">context_clause</FONT>'' allows it to
be the last item in the <FONT FACE="Arial, Helvetica">context_clause</FONT>.
It can't be first, because the <FONT FACE="Arial, Helvetica">name</FONT>
has to denote something mentioned earlier. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24</FONT></DIV>
<DIV Class="SyntaxIndented"><A NAME="I4008"></A><A NAME="I4009"></A>A
<FONT FACE="Arial, Helvetica">pragma</FONT> Elaborate_Body is a library
unit pragma. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>Hence, a <FONT FACE="Arial, Helvetica">pragma</FONT>
Elaborate or Elaborate_All is not elaborated, not that it makes any practical
difference.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Note that a <FONT FACE="Arial, Helvetica">pragma</FONT>
Elaborate or Elaborate_All is neither a program unit pragma, nor a library
unit pragma.</FONT></DIV>

<H4 ALIGN=CENTER>Legality Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>25</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;<A NAME="I4010"></A>If a <FONT FACE="Arial, Helvetica">pragma</FONT>
Elaborate_Body applies to a declaration, then the declaration requires
a completion [(a body)]. </DIV>

<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>26</FONT></DIV>
<DIV Class="Normal">&nbsp;&nbsp;&nbsp;&nbsp;[A <FONT FACE="Arial, Helvetica">pragma</FONT>
Elaborate specifies that the body of the named library unit is elaborated
before the current <FONT FACE="Arial, Helvetica">library_item</FONT>.
A <FONT FACE="Arial, Helvetica">pragma</FONT> Elaborate_All specifies
that each <FONT FACE="Arial, Helvetica">library_item</FONT> that is needed
by the named library unit declaration is elaborated before the current
<FONT FACE="Arial, Helvetica">library_item</FONT>. A <FONT FACE="Arial, Helvetica">pragma</FONT>
Elaborate_Body specifies that the body of the library unit is elaborated
immediately after its declaration.] </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>26.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Proof: </B>The official statement
of the semantics of these <FONT FACE="Arial, Helvetica">pragma</FONT>s
is given in <A HREF="AA-10-2.html">10.2</A>. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>26.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation Note: </B>The
presence of a <FONT FACE="Arial, Helvetica">pragma</FONT> Elaborate_Body
simplifies the removal of unnecessary Elaboration_Checks. For a subprogram
declared immediately within a library unit to which a <FONT FACE="Arial, Helvetica">pragma</FONT>
Elaborate_Body applies, the only calls that can fail the Elaboration_Check
are those that occur in the library unit itself, between the declaration
and body of the called subprogram; if there are no such calls (which
can easily be detected at compile time if there are no <FONT FACE="Arial, Helvetica">stub</FONT>s),
then no Elaboration_Checks are needed for that subprogram. The same is
true for Elaboration_Checks on task activations and instantiations, and
for library subprograms and generic units. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>26.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>The fact
that the unit of elaboration is the <FONT FACE="Arial, Helvetica">library_item</FONT>
means that if a <FONT FACE="Arial, Helvetica">subprogram_body</FONT>
is not a completion, it is impossible for any <FONT FACE="Arial, Helvetica">library_item</FONT>
to be elaborated between the declaration and the body of such a subprogram.
Therefore, it is impossible for a call to such a subprogram to fail its
Elaboration_Check. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>26.d</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>The visibility
rules imply that each <I>library_unit_</I><FONT FACE="Arial, Helvetica">name</FONT>
of a <FONT FACE="Arial, Helvetica">pragma</FONT> Elaborate or Elaborate_All
has to denote a library unit mentioned by a previous <FONT FACE="Arial, Helvetica">with_clause</FONT>
of the same <FONT FACE="Arial, Helvetica">context_clause</FONT>. </FONT></DIV>
<DIV Class="NotesHeader"><FONT SIZE=-1>NOTES</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>27</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>12&nbsp;&nbsp;A preelaborated library
unit is allowed to have non-preelaborable children. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>27.a/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>{<I><A HREF="defect1.html#8652/0035">8652/0035</A></I>}
But <U>generally </U>not non-preelaborated subunits. <U>(Non-preelaborated
subunits of subprograms are allowed as discussed above.)</U> </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>28</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>13&nbsp;&nbsp;A library unit that is
declared pure is allowed to have impure children. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>28.a/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>{<I><A HREF="defect1.html#8652/0035">8652/0035</A></I>}
But <U>generally </U>not impure subunits. <U>(Impure subunits of subprograms
are allowed as discussed above.)</U> </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>28.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>Pragma Elaborate
is mainly for closely related library units, such as when two package
bodies 'with' each other's declarations. In such cases, Elaborate_All
sometimes won't work. </FONT></DIV>

<H4 ALIGN=CENTER>Extensions to Ada 83</H4>
<DIV Class="Paranum"><FONT SIZE=-2>28.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><A NAME="I4011"></A>The concepts
of preelaborability and purity are new to Ada 95. The Elaborate_All,
Elaborate_Body, Preelaborate, and Pure <FONT FACE="Arial, Helvetica">pragma</FONT>s
are new to Ada 95.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>28.d</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Pragmas Elaborate are allowed
to be mixed in with the other things in the <FONT FACE="Arial, Helvetica">context_clause</FONT>
-- in Ada 83, they were required to appear last. </FONT></DIV>

<HR>
<P><A HREF="AA-TOC.html">Contents</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-0-29.html">Index</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-10-2.html">Previous</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-11.html">Next</A>&nbsp;&nbsp;&nbsp;<A HREF="AA-TTL.html">Legal</A></P>
</BODY>
</HTML>