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 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>Ada95 - Operational and Representation Attributes</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="RM-TOC.html">Contents</A> <A HREF="RM-0-29.html">Index</A> <A HREF="RM-13-2.html">Previous</A> <A HREF="RM-13-4.html">Next</A></P>
<HR>
<H1> 13.3 Operational and Representation Attributes</H1>
<DIV Class="Paranum"><FONT SIZE=-2>1/1</FONT></DIV>
<DIV Class="Normal"> <A NAME="I4150"></A><A NAME="I4151"></A>The
values of certain implementation-dependent characteristics can be obtained
by interrogating appropriate operational or representation attributes.
<A NAME="I4152"></A>Some of these attributes are specifiable via an <FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>.
</DIV>
<H4 ALIGN=CENTER>Syntax</H4>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">attribute_definition_clause<A NAME="I4153"></A>
::= </FONT><BR>
<B>for</B> <A NAME="I4154"></A><FONT FACE="Arial, Helvetica">local_name</FONT>'<A NAME="I4155"></A><FONT FACE="Arial, Helvetica">attribute_designator</FONT> <B>use</B> <A NAME="I4156"></A><FONT FACE="Arial, Helvetica">expression</FONT>;<BR>
| <B>for</B> <A NAME="I4157"></A><FONT FACE="Arial, Helvetica">local_name</FONT>'<A NAME="I4158"></A><FONT FACE="Arial, Helvetica">attribute_designator</FONT> <B>use</B> <A NAME="I4159"></A><FONT FACE="Arial, Helvetica">name</FONT>;</DIV>
<H4 ALIGN=CENTER>Name Resolution Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DIV Class="Normal"> For an <FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>
that specifies an attribute that denotes a value, the form with an <FONT FACE="Arial, Helvetica">expression</FONT>
shall be used. Otherwise, the form with a <FONT FACE="Arial, Helvetica">name</FONT>
shall be used.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<DIV Class="Normal"> <A NAME="I4160"></A>For an <FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>
that specifies an attribute that denotes a value or an object, the expected
type for the expression or <FONT FACE="Arial, Helvetica">name</FONT>
is that of the attribute. <A NAME="I4161"></A>For an <FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>
that specifies an attribute that denotes a subprogram, the expected profile
for the <FONT FACE="Arial, Helvetica">name</FONT> is the profile required
for the attribute. For an <FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>
that specifies an attribute that denotes some other kind of entity, the
<FONT FACE="Arial, Helvetica">name</FONT> shall resolve to denote an
entity of the appropriate kind. </DIV>
<H4 ALIGN=CENTER>Legality Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>5/1</FONT></DIV>
<DIV Class="Normal"> <A NAME="I4162"></A><A NAME="I4163"></A>An <FONT FACE="Arial, Helvetica">attribute_designator</FONT>
is allowed in an <FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>
only if this International Standard explicitly allows it, or for an implementation-defined
attribute if the implementation allows it. <A NAME="I4164"></A>Each specifiable
attribute constitutes an <A NAME="I4165"></A>operational aspect or aspect
of representation. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<DIV Class="Normal"> For an <FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>
that specifies an attribute that denotes a subprogram, the profile shall
be mode conformant with the one required for the attribute, and the convention
shall be Ada. Additional requirements are defined for particular attributes.
<A NAME="I4166"></A></DIV>
<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<DIV Class="Normal"> <A NAME="I4167"></A><A NAME="I4168"></A><A NAME="I4169"></A><A NAME="I4170"></A><A NAME="I4171"></A><A NAME="I4172"></A><A NAME="I4173"></A><A NAME="I4174"></A><A NAME="I4175"></A><A NAME="I4176"></A><A NAME="I4177"></A><A NAME="I4178"></A><A NAME="I4179"></A><A NAME="I4180"></A>A
<I>Size clause</I> is an <FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>
whose <FONT FACE="Arial, Helvetica">attribute_designator</FONT> is Size.
Similar definitions apply to the other specifiable attributes. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<DIV Class="Normal"> <A NAME="I4181"></A><A NAME="I4182"></A>A <I>storage
element</I> is an addressable element of storage in the machine. <A NAME="I4183"></A>A
<I>word</I> is the largest amount of storage that can be conveniently
and efficiently manipulated by the hardware, given the implementation's
run-time model. A word consists of an integral number of storage elements.
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9/1</FONT></DIV>
<DIV Class="Normal"> The following representation attributes are
defined: Address, Alignment, Size, Storage_Size, and Component_Size.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10/1</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> For a <FONT FACE="Arial, Helvetica">prefix</FONT>
X that denotes an object, program unit, or label: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11</FONT></DIV>
<DL Class="Hanging"><DT> X'Address<DD Class="Hanging">
<A NAME="I4184"></A><A NAME="I4185"></A>Denotes the address of the first
of the storage elements allocated to X. For a program unit or label,
this value refers to the machine code associated with the corresponding
body or <FONT FACE="Arial, Helvetica">statement</FONT>. The value of
this attribute is of type System.Address. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>12</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging"><A NAME="I4186"></A><A NAME="I4187"></A>Address
may be specified for stand-alone objects and for program units via an
<FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>. </DL>
<H4 ALIGN=CENTER>Erroneous Execution</H4>
<DIV Class="Paranum"><FONT SIZE=-2>13</FONT></DIV>
<DIV Class="Normal"> <A NAME="I4188"></A>If an Address is specified,
it is the programmer's responsibility to ensure that the address is valid;
otherwise, program execution is erroneous. </DIV>
<H4 ALIGN=CENTER>Implementation Advice</H4>
<DIV Class="Paranum"><FONT SIZE=-2>14</FONT></DIV>
<DIV Class="Normal"> For an array X, X'Address should point at the
first component of the array, and not at the array bounds. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>15</FONT></DIV>
<DIV Class="Normal"> <A NAME="I4189"></A>The recommended level of
support for the Address attribute is: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>16</FONT></DIV>
<UL Class="Bulleted" Style="margin-bottom: 0.3em"><LI TYPE=DISC>X'Address should produce a useful result if X is an object
that is aliased or of a by-reference type, or is an entity whose Address
has been specified. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>17</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>An implementation should support Address clauses for imported
subprograms.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>18</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>Objects (including subcomponents) that are aliased or of
a by-reference type should be allocated on storage element boundaries.
</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>19</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>If the Address of an object is specified, or it is imported
or exported, then the implementation should not perform optimizations
based on assumptions of no aliases. </LI></UL>
<DIV Class="NotesHeader"><FONT SIZE=-1>NOTES</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>20</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>1 The specification of a
link name in a <FONT FACE="Arial, Helvetica">pragma</FONT> Export (see
<A HREF="RM-B-1.html">B.1</A>) for a subprogram or object is an alternative
to explicit specification of its link-time address, allowing a link-time
directive to place the subprogram or object within memory.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>21</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>2 The rules for the Size
attribute imply, for an aliased object X, that if X'Size = Storage_Unit,
then X'Address points at a storage element containing all of the bits
of X, and only the bits of X. </FONT></DIV>
<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>22/1</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> For a <FONT FACE="Arial, Helvetica">prefix</FONT>
X that denotes a subtype or object: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>23</FONT></DIV>
<DL Class="Hanging"><DT> X'Alignment<DD Class="Hanging">
<A NAME="I4190"></A><A NAME="I4191"></A>The Address of an object that
is allocated under control of the implementation is an integral multiple
of the Alignment of the object (that is, the Address modulo the Alignment
is zero). The offset of a record component is a multiple of the Alignment
of the component. For an object that is not allocated under control of
the implementation (that is, one that is imported, that is allocated
by a user-defined allocator, whose Address has been specified, or is
designated by an access value returned by an instance of Unchecked_Conversion),
the implementation may assume that the Address is an integral multiple
of its Alignment. The implementation shall not assume a stricter alignment.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>24</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">The value of this attribute is of type <I>universal_integer</I>,
and nonnegative; zero means that the object is not necessarily aligned
on a storage element boundary. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>25</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging"><A NAME="I4192"></A><A NAME="I4193"></A>Alignment
may be specified for first subtypes and stand-alone objects via an <FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>;
the expression of such a clause shall be static, and its value nonnegative.
If the Alignment of a subtype is specified, then the Alignment of an
object of the subtype is at least as strict, unless the object's Alignment
is also specified. The Alignment of an object created by an allocator
is that of the designated subtype.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>26</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">If an Alignment is specified for a composite subtype
or object, this Alignment shall be equal to the least common multiple
of any specified Alignments of the subcomponent subtypes, or an integer
multiple thereof. </DL>
<H4 ALIGN=CENTER>Erroneous Execution</H4>
<DIV Class="Paranum"><FONT SIZE=-2>27</FONT></DIV>
<DIV Class="Normal"> <A NAME="I4194"></A>Program execution is erroneous
if an Address clause is given that conflicts with the Alignment. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>28</FONT></DIV>
<DIV Class="Normal"> <A NAME="I4195"></A>If the Alignment is specified
for an object that is not allocated under control of the implementation,
execution is erroneous if the object is not aligned according to the
Alignment. </DIV>
<H4 ALIGN=CENTER>Implementation Advice</H4>
<DIV Class="Paranum"><FONT SIZE=-2>29</FONT></DIV>
<DIV Class="Normal"> <A NAME="I4196"></A>The recommended level of
support for the Alignment attribute for subtypes is: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>30</FONT></DIV>
<UL Class="Bulleted" Style="margin-bottom: 0.3em"><LI TYPE=DISC>An implementation should support specified Alignments that
are factors and multiples of the number of storage elements per word,
subject to the following:</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>31</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>An implementation need not support specified Alignments
for combinations of Sizes and Alignments that cannot be easily loaded
and stored by available machine instructions.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>32</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>An implementation need not support specified Alignments
that are greater than the maximum Alignment the implementation ever returns
by default. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>33</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> <A NAME="I4197"></A>The
recommended level of support for the Alignment attribute for objects
is: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>34</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>Same as above, for subtypes, but in addition:</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>35</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>For stand-alone library-level objects of statically constrained
subtypes, the implementation should support all Alignments supported
by the target linker. For example, page alignment is likely to be supported
for such objects, but not for subtypes. </LI></UL>
<DIV Class="NotesHeader"><FONT SIZE=-1>NOTES</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>36</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>3 Alignment is a subtype-specific
attribute.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>37</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>4 The Alignment of a composite
object is always equal to the least common multiple of the Alignments
of its components, or a multiple thereof. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>38</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>5 A <FONT FACE="Arial, Helvetica">component_clause</FONT>,
Component_Size clause, or a <FONT FACE="Arial, Helvetica">pragma</FONT>
Pack can override a specified Alignment. </FONT></DIV>
<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>39/1</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> For a <FONT FACE="Arial, Helvetica">prefix</FONT>
X that denotes an object: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>40</FONT></DIV>
<DL Class="Hanging"><DT> X'Size<DD Class="Hanging">
<A NAME="I4198"></A><A NAME="I4199"></A>Denotes the size in bits of the
representation of the object. The value of this attribute is of the type
<I>universal_integer</I>. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>41</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging"><A NAME="I4200"></A><A NAME="I4201"></A>Size may
be specified for stand-alone objects via an <FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>;
the expression of such a clause shall be static and its value nonnegative.
</DL>
<H4 ALIGN=CENTER>Implementation Advice</H4>
<DIV Class="Paranum"><FONT SIZE=-2>42</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> <A NAME="I4202"></A>The
recommended level of support for the Size attribute of objects is: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>43</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>A Size clause should be supported for an object if the
specified Size is at least as large as its subtype's Size, and corresponds
to a size in storage elements that is a multiple of the object's Alignment
(if the Alignment is nonzero). </LI></UL>
<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>44</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> For every subtype
S: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>45</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT> S'Size<DD Class="Hanging">
<A NAME="I4203"></A><A NAME="I4204"></A>If S is definite, denotes the
size (in bits) that the implementation would choose for the following
objects of subtype S: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>46</FONT></DIV>
<UL Class="IndentedBulleted"><LI TYPE=DISC>A record component of subtype S when the record type is
packed.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>47</FONT></DIV>
<UL Class="IndentedBulleted"><LI TYPE=DISC>The formal parameter of an instance of Unchecked_Conversion
that converts from subtype S to some other subtype. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>48</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">If S is indefinite, the meaning is implementation
defined. The value of this attribute is of the type <I>universal_integer</I>.
<A NAME="I4205"></A><A NAME="I4206"></A>The Size of an object is at least
as large as that of its subtype, unless the object's Size is determined
by a Size clause, a component_clause, or a Component_Size clause. Size
may be specified for first subtypes via an <FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>;
the expression of such a clause shall be static and its value nonnegative.
</DL>
<H4 ALIGN=CENTER>Implementation Requirements</H4>
<DIV Class="Paranum"><FONT SIZE=-2>49</FONT></DIV>
<DIV Class="Normal"> In an implementation, Boolean'Size shall be 1.
</DIV>
<H4 ALIGN=CENTER>Implementation Advice</H4>
<DIV Class="Paranum"><FONT SIZE=-2>50</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> If the Size of
a subtype is specified, and allows for efficient independent addressability
(see <A HREF="RM-9-10.html">9.10</A>) on the target architecture, then
the Size of the following objects of the subtype should equal the Size
of the subtype: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>51</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>Aliased objects (including components).</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>52</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>Unaliased components, unless the Size of the component
is determined by a <FONT FACE="Arial, Helvetica">component_clause</FONT>
or Component_Size clause. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>53</FONT></DIV>
<DIV Class="Normal"> A Size clause on a composite subtype should not
affect the internal layout of components. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>54</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> <A NAME="I4207"></A>The
recommended level of support for the Size attribute of subtypes is: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>55</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>The Size (if not specified) of a static discrete or fixed
point subtype should be the number of bits needed to represent each value
belonging to the subtype using an unbiased representation, leaving space
for a sign bit only if the subtype contains negative values. If such
a subtype is a first subtype, then an implementation should support a
specified Size for it that reflects this representation.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>56</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>For a subtype implemented with levels of indirection, the
Size should include the size of the pointers, but not the size of what
they point at. </LI></UL>
<DIV Class="NotesHeader"><FONT SIZE=-1>NOTES</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>57</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>6 Size is a subtype-specific
attribute.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>58</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>7 A <FONT FACE="Arial, Helvetica">component_clause</FONT>
or Component_Size clause can override a specified Size. A <FONT FACE="Arial, Helvetica">pragma</FONT>
Pack cannot. </FONT></DIV>
<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>59/1</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> For a <FONT FACE="Arial, Helvetica">prefix</FONT>
T that denotes a task object (after any implicit dereference): </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>60</FONT></DIV>
<DL Class="Hanging"><DT> T'Storage_Size<DD Class="Hanging">
<A NAME="I4208"></A><A NAME="I4209"></A>Denotes the number of storage
elements reserved for the task. The value of this attribute is of the
type <I>universal_integer</I>. The Storage_Size includes the size of
the task's stack, if any. The language does not specify whether or not
it includes other storage associated with the task (such as the ``task
control block'' used by some implementations.) If a <FONT FACE="Arial, Helvetica">pragma</FONT>
Storage_Size is given, the value of the Storage_Size attribute is at
least the value specified in the <FONT FACE="Arial, Helvetica">pragma</FONT>.
</DL>
<DIV Class="Paranum"><FONT SIZE=-2>61</FONT></DIV>
<DIV Class="Normal"> <A NAME="I4210"></A>A <FONT FACE="Arial, Helvetica">pragma</FONT>
Storage_Size specifies the amount of storage to be reserved for the execution
of a task. </DIV>
<H4 ALIGN=CENTER>Syntax</H4>
<DIV Class="Paranum"><FONT SIZE=-2>62</FONT></DIV>
<DIV Class="SyntaxIndented" Style="margin-bottom: 0.2em">The form of
a <FONT FACE="Arial, Helvetica">pragma</FONT> Storage_Size is as follows:
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>63</FONT></DIV>
<DIV Class="SyntaxIndented"> <B>pragma</B> <A NAME="I4211"></A>Storage_Size(<A NAME="I4212"></A><FONT FACE="Arial, Helvetica">expression</FONT>);</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>64</FONT></DIV>
<DIV Class="SyntaxIndented">A <FONT FACE="Arial, Helvetica">pragma</FONT>
Storage_Size is allowed only immediately within a <FONT FACE="Arial, Helvetica">task_definition</FONT>.
</DIV>
<H4 ALIGN=CENTER>Name Resolution Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>65</FONT></DIV>
<DIV Class="Normal"> <A NAME="I4213"></A>The <FONT FACE="Arial, Helvetica">expression</FONT>
of a <FONT FACE="Arial, Helvetica">pragma</FONT> Storage_Size is expected
to be of any integer type. </DIV>
<H4 ALIGN=CENTER>Dynamic Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>66</FONT></DIV>
<DIV Class="Normal"> A <FONT FACE="Arial, Helvetica">pragma</FONT>
Storage_Size is elaborated when an object of the type defined by the
immediately enclosing <FONT FACE="Arial, Helvetica">task_definition</FONT>
is created. <A NAME="I4214"></A>For the elaboration of a <FONT FACE="Arial, Helvetica">pragma</FONT>
Storage_Size, the <FONT FACE="Arial, Helvetica">expression</FONT> is
evaluated; the Storage_Size attribute of the newly created task object
is at least the value of the <FONT FACE="Arial, Helvetica">expression</FONT>.
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>67</FONT></DIV>
<DIV Class="Normal"> <A NAME="I4215"></A><A NAME="I4216"></A><A NAME="I4217"></A>At
the point of task object creation, or upon task activation, Storage_Error
is raised if there is insufficient free storage to accommodate the requested
Storage_Size. </DIV>
<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>68/1</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> For a <FONT FACE="Arial, Helvetica">prefix</FONT>
X that denotes an array subtype or array object (after any implicit dereference):
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>69</FONT></DIV>
<DL Class="Hanging"><DT> X'Component_Size<DD Class="Hanging">
<A NAME="I4218"></A><A NAME="I4219"></A>Denotes the size in bits of components
of the type of X. The value of this attribute is of type <I>universal_integer</I>.
</DL>
<DIV Class="Paranum"><FONT SIZE=-2>70</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging"><A NAME="I4220"></A><A NAME="I4221"></A>Component_Size
may be specified for array types via an <FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>;
the expression of such a clause shall be static, and its value nonnegative.
</DL>
<H4 ALIGN=CENTER>Implementation Advice</H4>
<DIV Class="Paranum"><FONT SIZE=-2>71</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> <A NAME="I4222"></A>The
recommended level of support for the Component_Size attribute is: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>72</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>An implementation need not support specified Component_Sizes
that are less than the Size of the component subtype.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>73</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>An implementation should support specified Component_Sizes
that are factors and multiples of the word size. For such Component_Sizes,
the array should contain no gaps between components. For other Component_Sizes
(if supported), the array should contain no gaps between components when
packing is also specified; the implementation should forbid this combination
in cases where it cannot support a no-gaps representation. </LI></UL>
<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>73.1/1</FONT></DIV>
<DIV Class="Normal"> The following operational attribute is defined:
External_Tag.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>74/1</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> For every subtype
S of a tagged type <I>T</I> (specific or class-wide):</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>75/1</FONT></DIV>
<DL Class="Hanging"><DT> S'External_Tag<DD Class="Hanging">
<A NAME="I4223"></A><A NAME="I4224"></A><A NAME="I4225"></A><A NAME="I4226"></A>S'External_Tag
denotes an external string representation for S'Tag; it is of the predefined
type String. External_Tag may be specified for a specific tagged type
via an <FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>;
the expression of such a clause shall be static. The default external
tag representation is implementation defined. See <A HREF="RM-3-9-2.html">3.9.2</A>
and <A HREF="RM-13-13-2.html">13.13.2</A>. The value of External_Tag
is never inherited; the default value is always used unless a new value
is directly specified for a type. </DL>
<H4 ALIGN=CENTER>Implementation Requirements</H4>
<DIV Class="Paranum"><FONT SIZE=-2>76</FONT></DIV>
<DIV Class="Normal"> In an implementation, the default external tag
for each specific tagged type declared in a partition shall be distinct,
so long as the type is declared outside an instance of a generic body.
If the compilation unit in which a given tagged type is declared, and
all compilation units on which it semantically depends, are the same
in two different partitions, then the external tag for the type shall
be the same in the two partitions. What it means for a compilation unit
to be the same in two different partitions is implementation defined.
At a minimum, if the compilation unit is not recompiled between building
the two different partitions that include it, the compilation unit is
considered the same in the two partitions. </DIV>
<DIV Class="NotesHeader"><FONT SIZE=-1>NOTES</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>77</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>8 The following language-defined
attributes are specifiable, at least for some of the kinds of entities
to which they apply: Address, Size, Component_Size, Alignment, External_Tag,
Small, Bit_Order, Storage_Pool, Storage_Size, Write, Output, Read, Input,
and Machine_Radix.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>78</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>9 It follows from the general
rules in <A HREF="RM-13-1.html">13.1</A> that if one writes ``<B>for</B>
X'Size <B>use</B> Y;'' then the X'Size <FONT FACE="Arial, Helvetica">attribute_reference</FONT>
will return Y (assuming the implementation allows the Size clause). The
same is true for all of the specifiable attributes except Storage_Size.
</FONT></DIV>
<H4 ALIGN=CENTER>Examples</H4>
<DIV Class="Paranum"><FONT SIZE=-2>79</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> <I>Examples of
attribute definition clauses:</I> </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>80</FONT></DIV>
<DIV Class="Examples"><TT>Byte : <B>constant</B> := 8;<BR>
Page : <B>constant</B> := 2**12;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>81</FONT></DIV>
<DIV Class="Examples"><TT><B>type</B> Medium <B>is</B> <B>range</B> 0 .. 65_000;<BR>
<B>for</B> Medium'Size <B>use</B> 2*Byte;<BR>
<B>for</B> Medium'Alignment <B>use</B> 2;<BR>
Device_Register : Medium;<BR>
<B>for</B> Device_Register'Size <B>use</B> Medium'Size;<BR>
<B>for</B> Device_Register'Address <B>use</B> System.Storage_Elements.To_Address(16#FFFF_0020#);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>82</FONT></DIV>
<DIV Class="Examples"><TT><B>type</B> Short <B>is</B> <B>delta</B> 0.01 <B>range</B> -100.0 .. 100.0;<BR>
<B>for</B> Short'Size <B>use</B> 15;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>83</FONT></DIV>
<DIV Class="Examples"><TT><B>for</B> Car_Name'Storage_Size <B>use</B> --<I> specify access type's storage pool size</I><BR>
2000*((Car'Size/System.Storage_Unit) +1); --<I> approximately 2000 cars</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>84</FONT></DIV>
<DIV Class="Examples"><TT><B>function</B> My_Read(Stream : <B>access</B> Ada.Streams.Root_Stream_Type'Class)<BR>
<B>return</B> T;<BR>
<B>for</B> T'Read <B>use</B> My_Read; --<I> see <A HREF="RM-13-13-2.html">13.13.2</A></I></TT></DIV>
<DIV Class="NotesHeader"><FONT SIZE=-1>NOTES</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>85</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>10 <I>Notes on the examples:</I>
In the Size clause for Short, fifteen bits is the minimum necessary,
since the type definition requires Short'Small <= 2**(-7). </FONT></DIV>
<HR>
<P><A HREF="RM-TOC.html">Contents</A> <A HREF="RM-0-29.html">Index</A> <A HREF="RM-13-2.html">Previous</A> <A HREF="RM-13-4.html">Next</A> <A HREF="RM-TTL.html">Legal</A></P>
</BODY>
</HTML>
|