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 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>AARM95 - Operational and Representation Items</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> <A HREF="AA-0-29.html">Index</A> <A HREF="AA-13.html">Previous</A> <A HREF="AA-13-2.html">Next</A></P>
<HR>
<H1> 13.1 <U>Operational and Representation Items</U><S>Representation Items</S></H1>
<DIV Class="Paranum"><FONT SIZE=-2>0.1/1</FONT></DIV>
<DIV Class="Normal"> {<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
<U>[Representation and operational items can be used to specify aspects
of entities. Two kinds of aspects of entities can be specified: aspects
of representation and operational aspects. Representation items specify
how the types and other entities of the language are to be mapped onto
the underlying machine. Operational items specify other properties of
entities. ]</U></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>1/1</FONT></DIV>
<DIV Class="Normal"> {<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
<A NAME="I4328"></A><A NAME="I4329"></A><A NAME="I4330"></A>There are
<U>six</U><S>three</S> kinds of <I>representation items</I>: <U><FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>s
for representation attributes, <FONT FACE="Arial, Helvetica">enumeration_representation_clause</FONT>s,
<FONT FACE="Arial, Helvetica">record_representation_clause</FONT>s, <FONT FACE="Arial, Helvetica">at_clause</FONT>s,
</U><S><FONT FACE="Arial, Helvetica">representation_clause</FONT>s, </S><FONT FACE="Arial, Helvetica">component_clause</FONT>s,
and <I>representation pragmas</I>. [<S>Representation items specify how
the types and other entities of the language are to be mapped onto the
underlying machine.</S> They can be provided to give more efficient representation
or to interface with features that are outside the domain of the language
(for example, peripheral hardware). <S>Representation items also specify
other specifiable properties of entities. A representation item applies
to an entity identified by a <FONT FACE="Arial, Helvetica">local_name</FONT>,
which denotes an entity declared local to the current declarative region,
or a library unit declared immediately preceding a representation pragma
in a <FONT FACE="Arial, Helvetica">compilation</FONT>.</S>]</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>1.1/1</FONT></DIV>
<DIV Class="Normal"> {<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
<U>An <A NAME="I4331"></A><I>operational item</I> is an <FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>
for an operational attribute.</U></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>1.2/1</FONT></DIV>
<DIV Class="Normal"> {<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
<U>[An operational item or a representation item applies to an entity
identified by a <FONT FACE="Arial, Helvetica">local_name</FONT>, which
denotes an entity declared local to the current declarative region, or
a library unit declared immediately preceding a representation pragma
in a <FONT FACE="Arial, Helvetica">compilation</FONT>.]</U> </DIV>
<H4 ALIGN=CENTER>Language Design Principles</H4>
<DIV Class="Paranum"><FONT SIZE=-2>1.a.1/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>{<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
<U>Aspects of representation are intended to refer to properties that
need to be known before the compiler can generate code to create or access
an entity. For instance, the size of an object needs to be known before
the object can be created. Conversely, operational aspects are those
that only need to be known before they can be used. For instance, how
an object is read from a stream only needs to be known when a stream
read is executed. Thus, aspects of representation have stricter rules
as to when they can be specified.</U> </FONT></DIV>
<H4 ALIGN=CENTER>Syntax</H4>
<DIV Class="Paranum"><FONT SIZE=-2>2/1</FONT></DIV>
<DIV Class="SyntaxIndented">{<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
<FONT FACE="Arial, Helvetica"></FONT><U>aspect_clause</U><S>representation_clause</S><A NAME="I4332"></A>
::= <A NAME="I4333"></A><FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT><BR>
| <A NAME="I4334"></A><FONT FACE="Arial, Helvetica">enumeration_representation_clause</FONT><BR>
| <A NAME="I4335"></A><FONT FACE="Arial, Helvetica">record_representation_clause</FONT><BR>
| <A NAME="I4336"></A><FONT FACE="Arial, Helvetica">at_clause</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">local_name<A NAME="I4337"></A>
::= </FONT><A NAME="I4338"></A><FONT FACE="Arial, Helvetica">direct_name</FONT><BR>
| <A NAME="I4339"></A><FONT FACE="Arial, Helvetica">direct_name</FONT>'<A NAME="I4340"></A><FONT FACE="Arial, Helvetica">attribute_designator</FONT><BR>
| <I>library_unit_</I><A NAME="I4341"></A><FONT FACE="Arial, Helvetica">name</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4/1</FONT></DIV>
<DIV Class="SyntaxIndented">{<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
A representation pragma is allowed only at places where <U>an <FONT FACE="Arial, Helvetica">aspect_clause</FONT></U><S>a
<FONT FACE="Arial, Helvetica">representation_clause</FONT></S> or <FONT FACE="Arial, Helvetica">compilation_unit</FONT>
is allowed. <U><A NAME="I4342"></A></U></DIV>
<H4 ALIGN=CENTER>Name Resolution Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>5/1</FONT></DIV>
<DIV Class="Normal"> {<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
In <U>an operational item or</U><S>a</S> representation item, if the
<FONT FACE="Arial, Helvetica">local_name</FONT> is a <FONT FACE="Arial, Helvetica">direct_name</FONT>,
then it shall resolve to denote a declaration (or, in the case of a <FONT FACE="Arial, Helvetica">pragma</FONT>,
one or more declarations) that occurs immediately within the same <FONT FACE="Arial, Helvetica">declarative_region</FONT>
as the <S>representation </S>item. If the <FONT FACE="Arial, Helvetica">local_name</FONT>
has an <FONT FACE="Arial, Helvetica">attribute_designator</FONT>, then
it shall resolve to denote an implementation-defined component (see <A HREF="AA-13-5-1.html">13.5.1</A>)
or a class-wide type implicitly declared immediately within the same
<FONT FACE="Arial, Helvetica">declarative_region</FONT> as the <S>representation
</S>item. A <FONT FACE="Arial, Helvetica">local_name</FONT> that is a
<I>library_unit_</I><FONT FACE="Arial, Helvetica">name</FONT> (only permitted
in a representation pragma) shall resolve to denote the <FONT FACE="Arial, Helvetica">library_item</FONT>
that immediately precedes (except for other pragmas) the representation
pragma. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5.a/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>{<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
This is a Name Resolution Rule, because we don't want <U>an operational
or</U><S>a</S> representation item for X to be ambiguous just because
there's another X declared in an outer declarative region. It doesn't
make much difference, since most <U>operational or </U>representation
items are for types or subtypes, and type and subtype names can't be
overloaded. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5.b/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>{<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
The visibility rules imply that the declaration has to occur before the
<U>operational or </U>representation item.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5.c/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>{<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
For objects, this implies that <U>operational or </U>representation items
can be applied only to stand-alone objects. </FONT></DIV>
<H4 ALIGN=CENTER>Legality Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>6/1</FONT></DIV>
<DIV Class="Normal"> {<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
The <FONT FACE="Arial, Helvetica">local_name</FONT> of a <U><FONT FACE="Arial, Helvetica">aspect_clause</FONT></U><S><FONT FACE="Arial, Helvetica">representation_clause</FONT></S>
or representation pragma shall statically denote an entity (or, in the
case of a <FONT FACE="Arial, Helvetica">pragma</FONT>, one or more entities)
declared immediately preceding it in a <FONT FACE="Arial, Helvetica">compilation</FONT>,
or within the same <FONT FACE="Arial, Helvetica">declarative_part</FONT>,
<FONT FACE="Arial, Helvetica">package_specification</FONT>, <FONT FACE="Arial, Helvetica">task_definition</FONT>,
<FONT FACE="Arial, Helvetica">protected_definition</FONT>, or <FONT FACE="Arial, Helvetica">record_definition</FONT>
as the representation <U>or operational </U>item. If a <FONT FACE="Arial, Helvetica">local_name</FONT>
denotes a [local] callable entity, it may do so through a [local] <FONT FACE="Arial, Helvetica">subprogram_renaming_declaration</FONT>
[(as a way to resolve ambiguity in the presence of overloading)]; otherwise,
the <FONT FACE="Arial, Helvetica">local_name</FONT> shall not denote
a <FONT FACE="Arial, Helvetica">renaming_declaration</FONT>. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>The ``statically
denote'' part implies that it is impossible to specify the representation
of an object that is not a stand-alone object, except in the case of
a representation item like pragma Atomic that is allowed inside a <FONT FACE="Arial, Helvetica">component_list</FONT>
(in which case the representation item specifies the representation of
components of all objects of the type). It also prevents the problem
of renamings of things like ``P.<B>all</B>'' (where P is an access-to-subprogram
value) or ``E(I)'' (where E is an entry family).</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The part about where the denoted
entity has to have been declared appears twice -- once as a Name Resolution
Rule, and once as a Legality Rule. Suppose P renames Q, and we have a
representation item in a <FONT FACE="Arial, Helvetica">declarative_part</FONT>
whose <FONT FACE="Arial, Helvetica">local_name</FONT> is P. The fact
that the representation item has to appear in the same <FONT FACE="Arial, Helvetica">declarative_part</FONT>
as P is a Name Resolution Rule, whereas the fact that the representation
item has to appear in the same <FONT FACE="Arial, Helvetica">declarative_part</FONT>
as Q is a Legality Rule. This is subtle, but it seems like the least
confusing set of rules. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>A separate
Legality Rule applies for <FONT FACE="Arial, Helvetica">component_clause</FONT>s.
See <A HREF="AA-13-5-1.html">13.5.1</A>, ``<A HREF="AA-13-5-1.html">Record
Representation Clauses</A>''. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<DIV Class="Normal"> <A NAME="I4343"></A><A NAME="I4344"></A>The <I>representation</I>
of an object consists of a certain number of bits (the <I>size</I> of
the object). These are the bits that are normally read or updated by
the machine code when loading, storing, or operating-on the value of
the object. This includes some padding bits, when the size of the object
is greater than the size of its subtype. <A NAME="I4345"></A><A NAME="I4346"></A>Such
padding bits are considered to be part of the representation of the object,
rather than being gaps between objects, if these bits are normally read
and updated. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>To be honest: </B><A NAME="I4347"></A><A NAME="I4348"></A>Discontiguous
representations are allowed, but the ones we're interested in here are
generally contiguous sequences of bits. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7.b</FONT></DIV>
<DIV Class="Annotations" Style="margin-bottom: 0.4em"><FONT SIZE=-1><B>Ramification:
</B>Two objects with the same value do not necessarily have the same
representation. For example, an implementation might represent False
as zero and True as any odd value. Similarly, two objects (of the same
type) with the same sequence of bits do not necessarily have the same
value. For example, an implementation might use a biased representation
in some cases but not others: </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7.c</FONT></DIV>
<DIV Class="SmallExamples"><TT><B>subtype</B> S <B>is</B> Integer <B>range</B> 1..256;<BR>
<B>type</B> A <B>is</B> <B>array</B>(Natural <B>range</B> 1..4) <B>of</B> S;<BR>
<B>pragma</B> Pack(A);<BR>
X : S := 3;<BR>
Y : A := (1, 2, 3, 4);</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7.d</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The implementation might use a
biased-by-1 representation for the array elements, but not for X. X and
Y(3) have the same value, but different representation: the representation
of X is a sequence of (say) 32 bits: 0...011, whereas the representation
of Y(3) is a sequence of 8 bits: 00000010 (assuming a two's complement
representation).</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7.e</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Such tricks are not required,
but are allowed. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7.f</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>The value of
any padding bits is not specified by the language, though for a numeric
type, it will be much harder to properly implement the predefined operations
if the padding bits are not either all zero, or a sign extension. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7.g</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>For example,
suppose S'Size = 2, and an object X is of subtype S. If the machine code
typically uses a 32-bit load instruction to load the value of X, then
X'Size should be 32, even though 30 bits of the value are just zeros
or sign-extension bits. On the other hand, if the machine code typically
masks out those 30 bits, then X'Size should be 2. Usually, such masking
only happens for components of a composite type for which packing, Component_Size,
or record layout is specified.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7.h</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Note, however, that the formal
parameter of an instance of Unchecked_Conversion is a special case. Its
Size is required to be the same as that of its subtype.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7.i</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Note that we don't generally talk
about the representation of a value. A value is considered to be an amorphous
blob without any particular representation. An object is considered to
be more concrete. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<DIV Class="Normal"> <A NAME="I4349"></A><A NAME="I4350"></A><A NAME="I4351"></A>A
representation item <I>directly specifies</I> an <I>aspect of representation</I>
of the entity denoted by the <FONT FACE="Arial, Helvetica">local_name</FONT>,
except in the case of a type-related representation item, whose <FONT FACE="Arial, Helvetica">local_name</FONT>
shall denote a first subtype, and which directly specifies an aspect
of the subtype's type. <A NAME="I4352"></A><A NAME="I4353"></A><A NAME="I4354"></A><A NAME="I4355"></A>A
representation item that names a subtype is either <I>subtype-specific</I>
(Size and Alignment clauses) or <I>type-related</I> (all others). [Subtype-specific
aspects may differ for different subtypes of the same type.] </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>To be honest: </B><I>Type-related</I>
and <I>subtype-specific</I> are defined likewise for the corresponding
aspects of representation. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>To be honest: </B>Some representation
items directly specify more than one aspect. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>For example,
a <FONT FACE="Arial, Helvetica">pragma</FONT> Export specifies the convention
of an entity, and also specifies that it is exported. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.d</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>Each specifiable
attribute constitutes a separate aspect. An <FONT FACE="Arial, Helvetica">enumeration_representation_clause</FONT>
specifies the coding aspect. A <FONT FACE="Arial, Helvetica">record_representation_clause</FONT>
(without the <FONT FACE="Arial, Helvetica">mod_clause</FONT>) specifies
the record layout aspect. Each representation pragma specifies a separate
aspect. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.e</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>We don't need to
say that an <FONT FACE="Arial, Helvetica">at_clause</FONT> or a <FONT FACE="Arial, Helvetica">mod_clause</FONT>
specify separate aspects, because these are equivalent to <FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>s.
See <A HREF="AA-J-7.html">J.7</A>, ``<A HREF="AA-J-7.html">At Clauses</A>'',
and <A HREF="AA-J-8.html">J.8</A>, ``<A HREF="AA-J-8.html">Mod Clauses</A>''.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.f</FONT></DIV>
<DIV Class="Annotations" Style="margin-bottom: 0.4em"><FONT SIZE=-1><B>Ramification:
</B>The following representation items are type-related: </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.g</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC><FONT FACE="Arial, Helvetica">enumeration_representation_clause</FONT></LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.h</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC><FONT FACE="Arial, Helvetica">record_representation_clause</FONT></LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.i</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>Component_Size clause</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.j/1</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC><FONT SIZE=-1><I>This paragraph was deleted.</I></FONT>{<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
<S>External_Tag clause</S></LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.k</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>Small clause</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.l</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>Bit_Order clause</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.m</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>Storage_Pool clause</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.n</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>Storage_Size clause</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.o/1</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC><FONT SIZE=-1><I>This paragraph was deleted.</I></FONT>{<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
<S>Read clause</S></LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.p/1</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC><FONT SIZE=-1><I>This paragraph was deleted.</I></FONT>{<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
<S>Write clause</S></LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.q/1</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC><FONT SIZE=-1><I>This paragraph was deleted.</I></FONT>{<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
<S>Input clause</S></LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.r/1</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC><FONT SIZE=-1><I>This paragraph was deleted.</I></FONT>{<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
<S>Output clause</S></LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.s</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>Machine_Radix clause</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.t</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>pragma Pack</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.u</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>pragmas Import, Export, and Convention (when applied to
a type)</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.v</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>pragmas Atomic and Volatile (when applied to a type)</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.w</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>pragmas Atomic_Components and Volatile_Components (when
applied to an array type)</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.x</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>pragma Discard_Names (when applied to an enumeration or
tagged type) </LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.y</FONT></DIV>
<DIV Class="Annotations" Style="margin-bottom: 0.4em"><FONT SIZE=-1>The
following representation items are subtype-specific: </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.z</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>Alignment clause (when applied to a first subtype)</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.aa</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>Size clause (when applied to a first subtype) </LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.bb</FONT></DIV>
<DIV Class="Annotations" Style="margin-bottom: 0.4em"><FONT SIZE=-1>The
following representation items do not apply to subtypes, so they are
neither type-related nor subtype-specific: </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.cc</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>Address clause (applies to objects and program units)</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.dd</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>Alignment clause (when applied to an object)</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.ee</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>Size clause (when applied to an object)</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.ff</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>pragmas Import, Export, and Convention (when applied to
anything other than a type)</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.gg</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>pragmas Atomic and Volatile (when applied to an object
or a component)</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.hh</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>pragmas Atomic_Components and Volatile_Components (when
applied to an array object)</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.ii</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>pragma Discard_Names (when applied to an exception)</LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.jj</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC>pragma Asynchronous (applies to procedures) </LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.1/1</FONT></DIV>
<DIV Class="Normal"> {<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
<U>An operational item <I>directly specifies</I> an <I>operational aspect</I>
of the type of the subtype denoted by the <FONT FACE="Arial, Helvetica">local_name</FONT>.
The <FONT FACE="Arial, Helvetica">local_name</FONT> of an operational
item shall denote a first subtype. An operational item that names a subtype
is type-related. <A NAME="I4356"></A><A NAME="I4357"></A><A NAME="I4358"></A><A NAME="I4359"></A></U></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.jj.1/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>{<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
<U>The following operational items are type-related:</U> </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.jj.2/1</FONT></DIV>
<UL Class="SmallBulleted" Style="margin-bottom: 0.3em"><FONT SIZE=-1><LI TYPE=DISC><U>External_Tag clause</U></LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.jj.3/1</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC><U>Read clause</U></LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.jj.4/1</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC><U>Write clause</U></LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.jj.5/1</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC><U>Input clause</U></LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>8.jj.6/1</FONT></DIV>
<UL Class="SmallBulleted"><FONT SIZE=-1><LI TYPE=DISC><U>Output clause</U></LI></FONT></UL>
<DIV Class="Paranum"><FONT SIZE=-2>9</FONT></DIV>
<DIV Class="Normal"> A representation item that directly specifies
an aspect of a subtype or type shall appear after the type is completely
defined (see <A HREF="AA-3-11-1.html">3.11.1</A>), and before the subtype
or type is frozen (see <A HREF="AA-13-14.html">13.14</A>). If a representation
item is given that directly specifies an aspect of an entity, then it
is illegal to give another representation item that directly specifies
the same aspect of the entity. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9.a/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>{<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
The fact that a representation item <U>(or operational item, see next
paragraph) </U>that directly specifies an aspect of an entity is required
to appear before the entity is frozen prevents changing the representation
of an entity after using the entity in ways that require the representation
to be known. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9.1/1</FONT></DIV>
<DIV Class="Normal"> {<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
<U>An operational item that directly specifies an aspect of a type shall
appear before the type is frozen (see <A HREF="AA-13-14.html">13.14</A>).
If an operational item is given that directly specifies an aspect of
a type, then it is illegal to give another operational item that directly
specifies the same aspect of the type.</U> </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9.a.1/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B><U>Unlike
representation items, operational items can be specified on partial types.
Since they don't affect the representation, the full declaration need
not be known to determine their legality.</U> </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10</FONT></DIV>
<DIV Class="Normal"> For an untagged derived type, no type-related
representation items are allowed if the parent type is a by-reference
type, or has any user-defined primitive subprograms. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10.a/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>{<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
On the other hand, subtype-specific representation items may be given
for the first subtype of such a type<U>, as can operational items</U>.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>The reason for
forbidding type-related representation items on untagged by-reference
types is because a change of representation is impossible when passing
by reference (to an inherited subprogram). The reason for forbidding
type-related representation items on untagged types with user-defined
primitive subprograms was to prevent implicit change of representation
for type-related aspects of representation upon calling inherited subprograms,
because such changes of representation are likely to be expensive at
run time. Changes of subtype-specific representation attributes, however,
are likely to be cheap. This rule is not needed for tagged types, because
other rules prevent a type-related representation item from changing
the representation of the parent part; we want to allow a type-related
representation item on a type extension to specify aspects of the extension
part. For example, a <FONT FACE="Arial, Helvetica">pragma</FONT> Pack
will cause packing of the extension part, but not of the parent part.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11/1</FONT></DIV>
<DIV Class="Normal"> {<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
{<I><A HREF="defect1.html#8652/0011">8652/0011</A></I>} <U>Operational
and r</U><S>R</S>epresentation aspects of a generic formal parameter
are the same as those of the actual. <U>Operational and representation
aspects of a partial view are the same as those of the full view.</U>
A type-related representation item is not allowed for a descendant of
a generic formal untagged type. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11.a/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>{<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
Representation items are allowed for types whose subcomponent types or
index subtypes are generic formal types. <U>Operational items and subtype-related
representation items are allowed on descendants of generic formal types.</U>
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>Since it is not
known whether a formal type has user-defined primitive subprograms, specifying
type-related representation items for them is not allowed, unless they
are tagged (in which case only the extension part is affected in any
case). </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>12</FONT></DIV>
<DIV Class="Normal"> A representation item that specifies the Size
for a given subtype, or the size or storage place for an object (including
a component) of a given subtype, shall allow for enough storage space
to accommodate any value of the subtype.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>13/1</FONT></DIV>
<DIV Class="Normal"> {<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
A representation <U>or operational </U>item that is not supported by
the implementation is illegal, or raises an exception at run time. </DIV>
<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>14</FONT></DIV>
<DIV Class="Normal"> If two subtypes statically match, then their
subtype-specific aspects (Size and Alignment) are the same. <A NAME="I4360"></A></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>This is necessary
because we allow (for example) conversion between access types whose
designated subtypes statically match. Note that it is illegal to specify
an aspect (including a subtype-specific one) for a nonfirst subtype.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14.b</FONT></DIV>
<DIV Class="Annotations" Style="margin-bottom: 0.4em"><FONT SIZE=-1>Consider,
for example: </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14.c/1</FONT></DIV>
<DIV Class="SmallExamples"><TT><B>package</B> P1 <B>is</B><BR>
<B>subtype</B> S1 <B>is</B> Integer <B>range</B> 0..2**16-1;<BR>
<B>for</B> S1'Size <B>use</B> 16; --<I> Illegal!</I><BR>
--<I> S1'Size would be 16 by default.</I><BR>
<B>type</B> A1 <B>is</B> <B>access</B> <U><B>all</B> </U>S1;<BR>
X1: A1;<BR>
<B>end</B> P1;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14.d/1</FONT></DIV>
<DIV Class="SmallExamples"><TT><B>package</B> P2 <B>is</B><BR>
<B>subtype</B> S2 <B>is</B> Integer <B>range</B> 0..2**16-1;<BR>
<B>for</B> S2'Size <B>use</B> 32; --<I> Illegal!</I><BR>
<B>type</B> A2 <B>is</B> <B>access</B> <U><B>all</B> </U>S2;<BR>
X2: A2;<BR>
<B>end</B> P2;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14.e/1</FONT></DIV>
<DIV Class="SmallExamples"><TT><B>procedure</B> Q <B>is</B><BR>
<B>use</B> P1, P2;<BR>
<B>type</B> Array1 <B>is</B> <B>array</B>(Integer <B>range</B> <>) <B>of</B> <B>aliased</B> S1;<BR>
<B>pragma</B> Pack(Array1);<BR>
Obj1: Array1(1..100);<BR>
<B>type</B> Array2 <B>is</B> <B>array</B>(Integer <B>range</B> <>) <B>of</B> <B>aliased</B> S2;<BR>
<B>pragma</B> Pack(Array2);<BR>
Obj2: Array2(1..100);<BR>
<B>begin</B><BR>
X1 := Obj2(17)'<U>Unchecked_</U>Access;<BR>
X2 := Obj1(17)'<U>Unchecked_</U>Access;<BR>
<B>end</B> Q;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14.f</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Loads and stores through X1 would
read and write 16 bits, but X1 points to a 32-bit location. Depending
on the endianness of the machine, loads might load the wrong 16 bits.
Stores would fail to zero the other half in any case.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14.g</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Loads and stores through X2 would
read and write 32 bits, but X2 points to a 16-bit location. Thus, adjacent
memory locations would be trashed.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14.h</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Hence, the above is illegal. Furthermore,
the compiler is forbidden from choosing different Sizes by default, for
the same reason.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14.i</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The same issues apply to Alignment.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>15/1</FONT></DIV>
<DIV Class="Normal"> {<I><A HREF="defect1.html#8652/0040">8652/0040</A></I>}
A derived type inherits each type-related aspect <U>of representation
</U>of its parent type that was directly specified before the declaration
of the derived type, or (in the case where the parent is derived) that
was inherited by the parent type from the grandparent type. A derived
subtype inherits each subtype-specific aspect <U>of representation </U>of
its parent subtype that was directly specified before the declaration
of the derived type, or (in the case where the parent is derived) that
was inherited by the parent subtype from the grandparent subtype, but
only if the parent subtype statically matches the first subtype of the
parent type. An inherited aspect of representation is overridden by a
subsequent representation item that specifies the same aspect of the
type or subtype. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>15.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>To be honest: </B>A <FONT FACE="Arial, Helvetica">record_representation_clause</FONT>
for a record extension does not override the layout of the parent part;
if the layout was specified for the parent type, it is inherited by the
record extension. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>15.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>If a representation
item for the parent appears after the <FONT FACE="Arial, Helvetica">derived_type_declaration</FONT>,
then inheritance does not happen for that representation item. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>15.1/1</FONT></DIV>
<DIV Class="Normal"> {<I><A HREF="defect1.html#8652/0040">8652/0040</A></I>}
<U>In contrast, whether operational aspects are inherited by a derived
type depends on each specific aspect. When operational aspects are inherited
by a derived type, aspects that were directly specified before the declaration
of the derived type, or (in the case where the parent is derived) that
were inherited by the parent type from the grandparent type are inherited.
An inherited operational aspect is overridden by a subsequent operational
item that specifies the same aspect of the type.</U> </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>15.b.1/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B><U>As with
representation items, if an operational item for the parent appears after
the <FONT FACE="Arial, Helvetica">derived_type_declaration</FONT>, then
inheritance does not happen for that operational item.</U> </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>15.b.2/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B><U>Currently,
only untagged types inherit operational aspects. We considered writing
this rule that way, but rejected it as that could be too specific for
future operational aspects. (After all, that is precisely the problem
that caused us to introduce ``operational aspects'' in the first place.)</U>
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>16</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> Each aspect of
representation of an entity is as follows: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>17</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC><A NAME="I4361"></A>If the aspect is <I>specified</I> for
the entity, meaning that it is either directly specified or inherited,
then that aspect of the entity is as specified, except in the case of
Storage_Size, which specifies a minimum. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>17.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>This rule
implies that queries of the aspect return the specified value. For example,
if the user writes ``<B>for</B> X'Size <B>use</B> 32;'', then a query
of X'Size will return 32. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>18</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC><A NAME="I4362"></A>If an aspect of representation of an
entity is not specified, it is chosen by default in an unspecified manner.
</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>18.a/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>{<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
Note that <U>representation items</U><S><FONT FACE="Arial, Helvetica">representation_clause</FONT>s</S>
can affect the semantics of the entity.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>18.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The rules forbid things like ``<B>for</B>
S'Base'Alignment <B>use</B> ...'' and ``<B>for</B> S'Base <B>use</B>
record ...''. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>18.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>The intent
is that implementations will represent the components of a composite
value in the same way for all subtypes of a given composite type. Hence,
Component_Size and record layout are type-related aspects. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>18.1/1</FONT></DIV>
<DIV Class="Normal"> {<I><A HREF="defect1.html#8652/0040">8652/0040</A></I>}
<U><A NAME="I4363"></A>If an operational aspect is <I>specified</I> for
an entity (meaning that it is either directly specified or inherited),
then that aspect of the entity is as specified. Otherwise, the aspect
of the entity has the default value for that aspect.</U> </DIV>
<H4 ALIGN=CENTER>Dynamic Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>19/1</FONT></DIV>
<DIV Class="Normal"> {<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
<U><A NAME="I4364"></A></U><S><A NAME="I4365"></A></S>For the elaboration
of a <U><FONT FACE="Arial, Helvetica">aspect_clause</FONT></U><S><FONT FACE="Arial, Helvetica">representation_clause</FONT></S>,
any evaluable constructs within it are evaluated. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>19.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>Elaboration
of representation pragmas is covered by the general rules for pragmas
in Section 2. </FONT></DIV>
<H4 ALIGN=CENTER>Implementation Permissions</H4>
<DIV Class="Paranum"><FONT SIZE=-2>20</FONT></DIV>
<DIV Class="Normal"> An implementation may interpret aspects of representation
in an implementation-defined manner. An implementation may place implementation-defined
restrictions on representation items. <A NAME="I4366"></A>A <I>recommended
level of support</I> is specified for representation items and related
features in each subclause. These recommendations are changed to requirements
for implementations that support the Systems Programming Annex (see <A HREF="AA-C-2.html">C.2</A>,
``<A HREF="AA-C-2.html">Required Representation Support</A>''). </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>20.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation defined: </B>The
interpretation of each aspect of representation.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>20.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation defined: </B>Any
restrictions placed upon representation items.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>20.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>Implementation-defined
restrictions may be enforced either at compile time or at run time. There
is no requirement that an implementation justify any such restrictions.
They can be based on avoiding implementation complexity, or on avoiding
excessive inefficiency, for example.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>20.c.1/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>{<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
<U>There is no such permission for operational aspects.</U> </FONT></DIV>
<H4 ALIGN=CENTER>Implementation Advice</H4>
<DIV Class="Paranum"><FONT SIZE=-2>21</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> <A NAME="I4367"></A>The
recommended level of support for all representation items is qualified
as follows: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>22</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>An implementation need not support representation items
containing nonstatic expressions, except that an implementation should
support a representation item for a given entity if each nonstatic expression
in the representation item is a name that statically denotes a constant
declared before the entity. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>22.a</FONT></DIV>
<DIV Class="Annotations" Style="margin-bottom: 0.4em"><FONT SIZE=-1><B>Reason:
</B>This is to avoid the following sort of thing: </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>22.b</FONT></DIV>
<DIV Class="SmallExamples"><TT>X : Integer := F(...);<BR>
Y : Address := G(...);<BR>
<B>for</B> X'Address <B>use</B> Y;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>22.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>In the above, we have to evaluate
the initialization expression for X before we know where to put the result.
This seems like an unreasonable implementation burden.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>22.d</FONT></DIV>
<DIV Class="Annotations" Style="margin-bottom: 0.4em"><FONT SIZE=-1>The
above code should instead be written like this: </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>22.e</FONT></DIV>
<DIV Class="SmallExamples"><TT>Y : <B>constant</B> Address := G(...);<BR>
X : Integer := F(...);<BR>
<B>for</B> X'Address <B>use</B> Y;</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>22.f</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>This allows the expression ``Y''
to be safely evaluated before X is created.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>22.g</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The constant could be a formal
parameter of mode <B>in</B>.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>22.h</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>An implementation can support
other nonstatic expressions if it wants to. Expressions of type Address
are hardly ever static, but their value might be known at compile time
anyway in many cases. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>23</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>An implementation need not support a specification for
the Size for a given composite subtype, nor the size or storage place
for an object (including a component) of a given composite subtype, unless
the constraints on the subtype and its composite subcomponents (if any)
are all static constraints.</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>24</FONT></DIV>
<UL Class="Bulleted"><LI TYPE=DISC>An aliased component, or a component whose type is by-reference,
should always be allocated at an addressable location. </LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>24.a/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>The intent is that
access types, type System.Address, and the pointer used for a by-reference
parameter should be implementable as a single machine address -- bit-field
pointers should not be required. (There is no requirement that this implementation
be used -- we just want to make sure it<U>'</U>s feasible.) </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation Note: </B>Note
that the above rule does not apply to types that merely allow by-reference
parameter passing; for such types, a copy typically needs to be made
at the call site when a bit-aligned component is passed as a parameter.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24.c/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>A pragma
Pack will typically not pack so tightly as to disobey the above rule.
A Component_Size clause or <FONT FACE="Arial, Helvetica">record_representation_clause</FONT>
will typically b<U>e</U><S>y</S> illegal if it disobeys the above rule.
Atomic components have similar restrictions (see <A HREF="AA-C-6.html">C.6</A>,
``<A HREF="AA-C-6.html">Shared Variable Control</A>''). </FONT></DIV>
<H4 ALIGN=CENTER>Incompatibilities With Ada 83</H4>
<DIV Class="Paranum"><FONT SIZE=-2>24.d</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><A NAME="I4368"></A>It is now
illegal for a representation item to cause a derived by-reference type
to have a different record layout from its parent. This is necessary
for by-reference parameter passing to be feasible. This only affects
programs that specify the representation of types derived from types
containing tasks; most by-reference types are new to Ada 95. For example,
if A1 is an array of tasks, and A2 is derived from A1, it is illegal
to apply a <FONT FACE="Arial, Helvetica">pragma</FONT> Pack to A2. </FONT></DIV>
<H4 ALIGN=CENTER>Extensions to Ada 83</H4>
<DIV Class="Paranum"><FONT SIZE=-2>24.e/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>{<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
<A NAME="I4369"></A>Ada 95 allows additional <U><FONT FACE="Arial, Helvetica">aspect_clause</FONT>s</U><S><FONT FACE="Arial, Helvetica">representation_clause</FONT>s</S>
for objects. </FONT></DIV>
<H4 ALIGN=CENTER>Wording Changes from Ada 83</H4>
<DIV Class="Paranum"><FONT SIZE=-2>24.f/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>{<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
The syntax rule for <FONT FACE="Arial, Helvetica">type_representation_clause</FONT>
is removed; the right-hand side of that rule is moved up to where it
was used, in <U><FONT FACE="Arial, Helvetica">aspect_clause</FONT></U><S><FONT FACE="Arial, Helvetica">representation_clause</FONT></S>.
There are two references to ``type representation clause'' in RM83, both
in Section 13; these have been reworded. <U>Also, the <FONT FACE="Arial, Helvetica">representation_clause</FONT>
has been renamed the <FONT FACE="Arial, Helvetica">aspect_clause</FONT>
to reflect that it can be used to control more than just representation
aspects.</U></FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24.g/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>{<I><A HREF="defect1.html#8652/0009">8652/0009</A></I>}
We have defined a new term ``representation item,'' which includes <U>all
representation clauses</U><S><FONT FACE="Arial, Helvetica">representation_clause</FONT>s</S>
and representation pragmas, as well as <FONT FACE="Arial, Helvetica">component_clause</FONT>s.
This is convenient because the rules are almost identical for all <U>of
them</U><S>three</S>. <U>We have also defined the new terms ``operational
item'' and ``operational aspects'' in order to conveniently handle new
types of specifable entities.</U></FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24.h</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>All of the forcing occurrence
stuff has been moved into its own subclause (see <A HREF="AA-13-14.html">13.14</A>),
and rewritten to use the term ``freezing''.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24.i</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>RM83-13.1(10) requires implementation-defined
restrictions on representation items to be enforced at compile time.
However, that is impossible in some cases. If the user specifies a junk
(nonstatic) address in an address clause, and the implementation chooses
to detect the error (for example, using hardware memory management with
protected pages), then it's clearly going to be a run-time error. It
seems silly to call that ``semantics'' rather than ``a restriction.''</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24.j</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>RM83-13.1(10) tries to pretend
that <FONT FACE="Arial, Helvetica">representation_clause</FONT>s don't
affect the semantics of the program. One counter-example is the Small
clause. Ada 95 has more counter-examples. We have noted the opposite
above.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24.k</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Some of the more stringent requirements
are moved to <A HREF="AA-C-2.html">C.2</A>, ``<A HREF="AA-C-2.html">Required
Representation Support</A>''. </FONT></DIV>
<HR>
<P><A HREF="AA-TOC.html">Contents</A> <A HREF="AA-0-29.html">Index</A> <A HREF="AA-13.html">Previous</A> <A HREF="AA-13-2.html">Next</A> <A HREF="AA-TTL.html">Legal</A></P>
</BODY>
</HTML>
|