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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>AARM95 - Scalar Types</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-3-4-1.html">Previous</A> <A HREF="AA-3-5-1.html">Next</A></P>
<HR>
<H1> 3.5 Scalar Types</H1>
<DIV Class="Paranum"><FONT SIZE=-2>1</FONT></DIV>
<DIV Class="Normal"> <A NAME="I1539"></A><I>Scalar</I> types comprise
enumeration types, integer types, and real types. <A NAME="I1540"></A>Enumeration
types and integer types are called <I>discrete</I> types; <A NAME="I1541"></A>each
value of a discrete type has a <I>position number</I> which is an integer
value. <A NAME="I1542"></A>Integer types and real types are called <I>numeric</I>
types. [All scalar types are ordered, that is, all relational operators
are predefined for their values.]</DIV>
<H4 ALIGN=CENTER>Syntax</H4>
<DIV Class="Paranum"><FONT SIZE=-2>2</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">range_constraint<A NAME="I1543"></A>
::= </FONT> <B>range</B> <A NAME="I1544"></A><FONT FACE="Arial, Helvetica">range</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3</FONT></DIV>
<DIV Class="SyntaxIndented"><FONT FACE="Arial, Helvetica">range<A NAME="I1545"></A>
::= </FONT> <A NAME="I1546"></A><FONT FACE="Arial, Helvetica">range_attribute_reference</FONT><BR>
| <A NAME="I1547"></A><FONT FACE="Arial, Helvetica">simple_expression</FONT> .. <A NAME="I1548"></A><FONT FACE="Arial, Helvetica">simple_expression</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>3.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>These need
to be <FONT FACE="Arial, Helvetica">simple_expression</FONT>s rather
than more general <FONT FACE="Arial, Helvetica">expression</FONT>s because
ranges appear in membership tests and other contexts where <FONT FACE="Arial, Helvetica">expression</FONT>
.. <FONT FACE="Arial, Helvetica">expression</FONT> would be ambiguous.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>4</FONT></DIV>
<DIV Class="Normal"> <A NAME="I1549"></A><A NAME="I1550"></A><A NAME="I1551"></A><A NAME="I1552"></A>A
<I>range</I> has a <I>lower bound</I> and an <I>upper bound</I> and specifies
a subset of the values of some scalar type (the <I>type of the range</I>).
A range with lower bound L and upper bound R is described by ``L .. R''.
<A NAME="I1553"></A>If R is less than L, then the range is a <I>null
range</I>, and specifies an empty set of values. Otherwise, the range
specifies the values of the type from the lower bound to the upper bound,
inclusive. <A NAME="I1554"></A>A value <I>belongs</I> to a range if it
is of the type of the range, and is in the subset of values specified
by the range. <A NAME="I1555"></A>A value <I>satisfies</I> a range constraint
if it belongs to the associated range. <A NAME="I1556"></A>One range
is <I>included</I> in another if all values that belong to the first
range also belong to the second. </DIV>
<H4 ALIGN=CENTER>Name Resolution Rules</H4>
<DIV Class="Paranum"><FONT SIZE=-2>5</FONT></DIV>
<DIV Class="Normal"> <A NAME="I1557"></A>For a <FONT FACE="Arial, Helvetica">subtype_indication</FONT>
containing a <FONT FACE="Arial, Helvetica">range_constraint</FONT>, either
directly or as part of some other <FONT FACE="Arial, Helvetica">scalar_constraint</FONT>,
the type of the <FONT FACE="Arial, Helvetica">range</FONT> shall resolve
to that of the type determined by the <FONT FACE="Arial, Helvetica">subtype_mark</FONT>
of the <FONT FACE="Arial, Helvetica">subtype_indication</FONT>. <A NAME="I1558"></A>For
a <FONT FACE="Arial, Helvetica">range</FONT> of a given type, the <FONT FACE="Arial, Helvetica">simple_expression</FONT>s
of the <FONT FACE="Arial, Helvetica">range</FONT> (likewise, the <FONT FACE="Arial, Helvetica">simple_expression</FONT>s
of the equivalent <FONT FACE="Arial, Helvetica">range</FONT> for a <FONT FACE="Arial, Helvetica">range_attribute_reference</FONT>)
are expected to be of the type of the <FONT FACE="Arial, Helvetica">range</FONT>.
</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>In Ada 95,
<FONT FACE="Arial, Helvetica">constraint</FONT>s only appear within <FONT FACE="Arial, Helvetica">subtype_indication</FONT>s;
things that look like constraints that appear in type declarations are
called something else like <FONT FACE="Arial, Helvetica">range_specification</FONT>s.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>We say "the expected type
is ..." or "the type is expected to be ..." depending
on which reads better. They are fundamentally equivalent, and both feed
into the type resolution rules of clause <A HREF="AA-8-6.html">8.6</A>.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>5.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>In some cases, it doesn't work
to use expected types. For example, in the above rule, we say that the
``type of the <FONT FACE="Arial, Helvetica">range</FONT> shall resolve
to ...'' rather than ``the expected type for the <FONT FACE="Arial, Helvetica">range</FONT>
is ...''. We then use ``expected type'' for the bounds. If we used ``expected''
at both points, there would be an ambiguity, since one could apply the
rules of <A HREF="AA-8-6.html">8.6</A> either on determining the type
of the range, or on determining the types of the individual bounds. It
is clearly important to allow one bound to be of a universal type, and
the other of a specific type, so we need to use ``expected type'' for
the bounds. Hence, we used ``shall resolve to'' for the type of the range
as a whole. There are other situations where ``expected type'' is not
quite right, and we use ``shall resolve to'' instead. </FONT></DIV>
<H4 ALIGN=CENTER>Static Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>6</FONT></DIV>
<DIV Class="Normal"> <A NAME="I1559"></A>The <I>base range</I> of a
scalar type is the range of finite values of the type that can be represented
in every unconstrained object of the type; it is also the range supported
at a minimum for intermediate values during the evaluation of expressions
involving predefined operators of the type. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation Note: </B>Note
that in some machine architectures intermediates in an expression (particularly
if static), and register-resident variables might accommodate a wider
range. The base range does not include the values of this wider range
that are not assignable without overflow to memory-resident objects.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B><A NAME="I1560"></A>The
base range of an enumeration type is the range of values of the enumeration
type. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>If the representation
supports infinities, the base range is nevertheless restricted to include
only the representable finite values, so that 'Base'First and 'Base'Last
are always guaranteed to be finite.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>6.d</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>To be honest: </B>By a "value
that can be assigned without overflow" we don't mean to restrict
ourselves to values that can be represented exactly. Values between machine
representable values can be assigned, but on subsequent reading, a slightly
different value might be retrieved, as (partially) determined by the
number of digits of precision of the type. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>7</FONT></DIV>
<DIV Class="Normal"> <A NAME="I1561"></A><A NAME="I1562"></A>[A constrained
scalar subtype is one to which a range constraint applies.] <A NAME="I1563"></A>The
<I>range</I> of a constrained scalar subtype is the range associated
with the range constraint of the subtype. The <I>range</I> of an unconstrained
scalar subtype is the base range of its type. </DIV>
<H4 ALIGN=CENTER>Dynamic Semantics</H4>
<DIV Class="Paranum"><FONT SIZE=-2>8</FONT></DIV>
<DIV Class="Normal"> <A NAME="I1564"></A>A range is <I>compatible</I>
with a scalar subtype if and only if it is either a null range or each
bound of the range belongs to the range of the subtype. <A NAME="I1565"></A>A
<FONT FACE="Arial, Helvetica">range_constraint</FONT> is <I>compatible</I>
with a scalar subtype if and only if its range is compatible with the
subtype. </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>8.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>Only <FONT FACE="Arial, Helvetica">range_constraint</FONT>s
(explicit or implicit) impose conditions on the values of a scalar subtype.
The other <FONT FACE="Arial, Helvetica">scalar_constraint</FONT>s, <FONT FACE="Arial, Helvetica">digit_constraint</FONT>s
and <FONT FACE="Arial, Helvetica">delta_constraint</FONT>s impose conditions
on the subtype denoted by the <FONT FACE="Arial, Helvetica">subtype_mark</FONT>
in a <FONT FACE="Arial, Helvetica">subtype_indication</FONT>, but don't
impose a condition on the values of the subtype being defined. Therefore,
a scalar subtype is not called <I>constrained</I> if all that applies
to it is a <FONT FACE="Arial, Helvetica">digits_constraint</FONT>. Decimal
subtypes are subtle, because a <FONT FACE="Arial, Helvetica">digits_constraint</FONT>
without a <FONT FACE="Arial, Helvetica">range_constraint</FONT> nevertheless
includes an implicit <FONT FACE="Arial, Helvetica">range_constraint</FONT>.
</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>9</FONT></DIV>
<DIV Class="Normal"> <A NAME="I1566"></A>The elaboration of a <FONT FACE="Arial, Helvetica">range_constraint</FONT>
consists of the evaluation of the <FONT FACE="Arial, Helvetica">range</FONT>.
<A NAME="I1567"></A>The evaluation of a <FONT FACE="Arial, Helvetica">range</FONT>
determines a lower bound and an upper bound. If <FONT FACE="Arial, Helvetica">simple_expression</FONT>s
are given to specify bounds, the evaluation of the <FONT FACE="Arial, Helvetica">range</FONT>
evaluates these <FONT FACE="Arial, Helvetica">simple_expression</FONT>s
in an arbitrary order, and converts them to the type of the <FONT FACE="Arial, Helvetica">range</FONT>.
<A NAME="I1568"></A>If a <FONT FACE="Arial, Helvetica">range_attribute_reference</FONT>
is given, the evaluation of the <FONT FACE="Arial, Helvetica">range</FONT>
consists of the evaluation of the <FONT FACE="Arial, Helvetica">range_attribute_reference</FONT>.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>10</FONT></DIV>
<DIV Class="Normal"> <I>Attributes</I></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>11</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> For every scalar
subtype S, the following attributes are defined: </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>12</FONT></DIV>
<DL Class="Hanging"><DT> S'First<DD Class="Hanging">
<A NAME="I1569"></A><A NAME="I1570"></A>S'First denotes the lower bound
of the range of S. The value of this attribute is of the type of S. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>12.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>Evaluating
S'First never raises Constraint_Error.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>13</FONT></DIV>
<DL Class="Hanging"><DT> S'Last<DD Class="Hanging">
<A NAME="I1571"></A><A NAME="I1572"></A>S'Last denotes the upper bound
of the range of S. The value of this attribute is of the type of S. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>13.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>Evaluating
S'Last never raises Constraint_Error.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>14</FONT></DIV>
<DL Class="Hanging"><DT> S'Range<DD Class="Hanging">
<A NAME="I1573"></A><A NAME="I1574"></A>S'Range is equivalent to the
<FONT FACE="Arial, Helvetica">range</FONT> S'First .. S'Last.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>15</FONT></DIV>
<DL Class="Hanging"><DT> S'Base<DD Class="Hanging">
<A NAME="I1575"></A><A NAME="I1576"></A>S'Base denotes an unconstrained
subtype of the type of S. This unconstrained subtype is called the <I>base
subtype</I> of the type. <A NAME="I1577"></A></DL>
<DIV Class="Paranum"><FONT SIZE=-2>16</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT> S'Min<DD Class="Hanging">
<A NAME="I1578"></A><A NAME="I1579"></A>S'Min denotes a function with
the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>17</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>function</B> S'Min(<I>Left</I>, <I>Right</I> : S'Base)<BR>
<B>return</B> S'Base</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>18</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">The function returns the lesser of the values of
the two parameters. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>18.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B><A NAME="I1580"></A>The
formal parameter names are italicized because they cannot be used in
calls -- see <A HREF="AA-6-4.html">6.4</A>. Such a specification cannot
be written by the user because an <FONT FACE="Arial, Helvetica">attribute_reference</FONT>
is not permitted as the designator of a user-defined function, nor can
its formal parameters be anonymous. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>19</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT> S'Max<DD Class="Hanging">
<A NAME="I1581"></A><A NAME="I1582"></A>S'Max denotes a function with
the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>20</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>function</B> S'Max(<I>Left</I>, <I>Right</I> : S'Base)<BR>
<B>return</B> S'Base</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>21</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">The function returns the greater of the values of
the two parameters.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>22</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT> S'Succ<DD Class="Hanging">
<A NAME="I1583"></A><A NAME="I1584"></A>S'Succ denotes a function with
the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>23</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>function</B> S'Succ(<I>Arg</I> : S'Base)<BR>
<B>return</B> S'Base</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>24</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging"><A NAME="I1585"></A>For an enumeration type, the
function returns the value whose position number is one more than that
of the value of <I>Arg</I>; <A NAME="I1586"></A><A NAME="I1587"></A>Constraint_Error
is raised if there is no such value of the type. For an integer type,
the function returns the result of adding one to the value of <I>Arg</I>.
For a fixed point type, the function returns the result of adding <I>small</I>
to the value of <I>Arg</I>. For a floating point type, the function returns
the machine number (as defined in <A HREF="AA-3-5-7.html">3.5.7</A>)
immediately above the value of <I>Arg</I>; <A NAME="I1588"></A><A NAME="I1589"></A>Constraint_Error
is raised if there is no such machine number. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>24.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>S'Succ for
a modular integer subtype wraps around if the value of <I>Arg</I> is
S'Base'Last. S'Succ for a signed integer subtype might raise Constraint_Error
if the value of <I>Arg</I> is S'Base'Last, or it might return the out-of-base-range
value S'Base'Last+1, as is permitted for all predefined numeric operations.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>25</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT> S'Pred<DD Class="Hanging">
<A NAME="I1590"></A><A NAME="I1591"></A>S'Pred denotes a function with
the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>26</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>function</B> S'Pred(<I>Arg</I> : S'Base)<BR>
<B>return</B> S'Base</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>27</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging"><A NAME="I1592"></A>For an enumeration type, the
function returns the value whose position number is one less than that
of the value of <I>Arg</I>; <A NAME="I1593"></A><A NAME="I1594"></A>Constraint_Error
is raised if there is no such value of the type. For an integer type,
the function returns the result of subtracting one from the value of
<I>Arg</I>. For a fixed point type, the function returns the result of
subtracting <I>small</I> from the value of <I>Arg</I>. For a floating
point type, the function returns the machine number (as defined in <A HREF="AA-3-5-7.html">3.5.7</A>)
immediately below the value of <I>Arg</I>; <A NAME="I1595"></A><A NAME="I1596"></A>Constraint_Error
is raised if there is no such machine number. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>27.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Ramification: </B>S'Pred for
a modular integer subtype wraps around if the value of <I>Arg</I> is
S'Base'First. S'Pred for a signed integer subtype might raise Constraint_Error
if the value of <I>Arg</I> is S'Base'First, or it might return the out-of-base-range
value S'Base'First-1, as is permitted for all predefined numeric operations.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>28</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT> S'Wide_Image<DD Class="Hanging">
<A NAME="I1597"></A><A NAME="I1598"></A>S'Wide_Image denotes a function
with the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>29</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>function</B> S'Wide_Image(<I>Arg</I> : S'Base)<BR>
<B>return</B> Wide_String</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>30</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging"><A NAME="I1599"></A>The function returns an <I>image</I>
of the value of <I>Arg</I>, that is, a sequence of characters representing
the value in display form. The lower bound of the result is one.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>31</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">The image of an integer value is the corresponding
decimal literal, without underlines, leading zeros, exponent, or trailing
spaces, but with a single leading character that is either a minus sign
or a space. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>31.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation Note: </B>If
the machine supports negative zeros for signed integer types, it is not
specified whether "-0" or " 0" should be returned
for negative zero. We don't have enough experience with such machines
to know what is appropriate, and what other languages do. In any case,
the implementation should be consistent.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>32</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging"><A NAME="I1600"></A>The image of an enumeration
value is either the corresponding identifier in upper case or the corresponding
character literal (including the two apostrophes); neither leading nor
trailing spaces are included. For a <I>nongraphic character</I> (a value
of a character type that has no enumeration literal associated with it),
the result is a corresponding language-defined or implementation-defined
name in upper case (for example, the image of the nongraphic character
identified as <I>nul</I> is ``NUL'' -- the quotes are not part of the
image). </DL>
<DIV Class="Paranum"><FONT SIZE=-2>32.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation Note: </B>For
an enumeration type T that has ``holes'' (caused by an <FONT FACE="Arial, Helvetica">enumeration_representation_clause</FONT>),
<A NAME="I1601"></A>T'Wide_Image should raise Program_Error if the value
is one of the holes (which is a bounded error anyway, since holes can
be generated only via uninitialized variables and similar things. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>33</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">The image of a floating point value is a decimal
real literal best approximating the value (rounded away from zero if
halfway between) with a single leading character that is either a minus
sign or a space, a single digit (that is nonzero unless the value is
zero), a decimal point, S'Digits-1 (see <A HREF="AA-3-5-8.html">3.5.8</A>)
digits after the decimal point (but one if S'Digits is one), an upper
case E, the sign of the exponent (either + or -), and two or more digits
(with leading zeros if necessary) representing the exponent. If S'Signed_Zeros
is True, then the leading character is a minus sign for a negatively
signed zero. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>33.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>To be honest: </B>Leading zeros
are present in the exponent only if necessary to make the exponent at
least two digits. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>33.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>This image is intended
to conform to that produced by Text_IO.Float_IO.Put in its default format.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>33.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation Note: </B>The
rounding direction is specified here to ensure portability of output
results.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>34</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">The image of a fixed point value is a decimal real
literal best approximating the value (rounded away from zero if halfway
between) with a single leading character that is either a minus sign
or a space, one or more digits before the decimal point (with no redundant
leading zeros), a decimal point, and S'Aft (see <A HREF="AA-3-5-10.html">3.5.10</A>)
digits after the decimal point. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>34.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>This image is intended
to conform to that produced by Text_IO.Fixed_IO.Put.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>34.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation Note: </B>The
rounding direction is specified here to ensure portability of output
results.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>34.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation Note: </B>For
a machine that supports negative zeros, it is not specified whether "-0.000"
or " 0.000" is returned. See corresponding comment above about
integer types with signed zeros.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>35</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT> S'Image<DD Class="Hanging">
<A NAME="I1602"></A><A NAME="I1603"></A>S'Image denotes a function with
the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>36</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>function</B> S'Image(<I>Arg</I> : S'Base)<BR>
<B>return</B> String</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>37</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">The function returns an image of the value of <I>Arg</I>
as a String. The lower bound of the result is one. The image has the
same sequence of graphic characters as that defined for S'Wide_Image
if all the graphic characters are defined in Character; otherwise the
sequence of characters is implementation defined (but no shorter than
that of S'Wide_Image for the same value of <I>Arg</I>). </DL>
<DIV Class="Paranum"><FONT SIZE=-2>37.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Implementation defined: </B>The
sequence of characters of the value returned by S'Image when some of
the graphic characters of S'Wide_Image are not defined in Character.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>38</FONT></DIV>
<DL Class="Hanging"><DT> S'Wide_Width<DD Class="Hanging">
<A NAME="I1604"></A><A NAME="I1605"></A>S'Wide_Width denotes the maximum
length of a Wide_String returned by S'Wide_Image over all values of the
subtype S. It denotes zero for a subtype that has a null range. Its type
is <I>universal_integer</I>.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>39</FONT></DIV>
<DL Class="Hanging"><DT> S'Width<DD Class="Hanging">
<A NAME="I1606"></A><A NAME="I1607"></A>S'Width denotes the maximum length
of a String returned by S'Image over all values of the subtype S. It
denotes zero for a subtype that has a null range. Its type is <I>universal_integer</I>.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>40</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT> S'Wide_Value<DD Class="Hanging">
<A NAME="I1608"></A><A NAME="I1609"></A>S'Wide_Value denotes a function
with the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>41</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>function</B> S'Wide_Value(<I>Arg</I> : Wide_String)<BR>
<B>return</B> S'Base</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>42</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">This function returns a value given an image of
the value as a Wide_String, ignoring any leading or trailing spaces.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>43</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging"><A NAME="I1610"></A><A NAME="I1611"></A>For the
evaluation of a call on S'Wide_Value for an enumeration subtype S, if
the sequence of characters of the parameter (ignoring leading and trailing
spaces) has the syntax of an enumeration literal and if it corresponds
to a literal of the type of S (or corresponds to the result of S'Wide_Image
for a nongraphic character of the type), the result is the corresponding
enumeration value; <A NAME="I1612"></A><A NAME="I1613"></A>otherwise
Constraint_Error is raised. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>43.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>It's not crystal
clear that Range_Check is appropriate here, but it doesn't seem worthwhile
to invent a whole new check name just for this weird case, so we decided
to lump it in with Range_Check. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>43.a.1/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>To be honest: </B>{<I><A HREF="defect2.html#8652/0096">8652/0096</A></I>}
<U>A sequence of characters corresponds to the result of S'Wide_Image
if it is the same ignoring case. Thus, the case of an image of a nongraphic
character does not matter. For example, Character'Wide_Value("nul")
does not raise Constraint_Error, even though Character'Wide_Image returns
"NUL" for the nul character.</U> </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>44</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging"><A NAME="I1614"></A>For the evaluation of a call
on S'Wide_Value (or S'Value) for an integer subtype S, if the sequence
of characters of the parameter (ignoring leading and trailing spaces)
has the syntax of an integer literal, with an optional leading sign character
(plus or minus for a signed type; only plus for a modular type), and
the corresponding numeric value belongs to the base range of the type
of S, then that value is the result; <A NAME="I1615"></A><A NAME="I1616"></A>otherwise
Constraint_Error is raised.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>44.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>We considered
allowing 'Value to return a representable but out-of-range value without
a Constraint_Error. However, we currently require (see <A HREF="AA-4-9.html">4.9</A>)
in an <FONT FACE="Arial, Helvetica">assignment_statement</FONT> like
"X := <numeric_literal>;" that the value of the numeric-literal
be in X's base range (at compile time), so it seems unfriendly and confusing
to have a different range allowed for 'Value. Furthermore, for modular
types, without the requirement for being in the base range, 'Value would
have to handle arbitrarily long literals (since overflow never occurs
for modular types). </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>45</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DD Class ="Hanging">For the evaluation of a call on S'Wide_Value (or
S'Value) for a real subtype S, if the sequence of characters of the parameter
(ignoring leading and trailing spaces) has the syntax of one of the following:
</DL>
<DIV Class="Paranum"><FONT SIZE=-2>46</FONT></DIV>
<UL Class="IndentedBulleted"><LI TYPE=DISC><FONT FACE="Arial, Helvetica">numeric_literal</FONT></LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>47</FONT></DIV>
<UL Class="IndentedBulleted"><LI TYPE=DISC><FONT FACE="Arial, Helvetica">numeral</FONT>.[<FONT FACE="Arial, Helvetica">exponent</FONT>]</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>48</FONT></DIV>
<UL Class="IndentedBulleted"><LI TYPE=DISC>.<FONT FACE="Arial, Helvetica">numeral</FONT>[<FONT FACE="Arial, Helvetica">exponent</FONT>]</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>49</FONT></DIV>
<UL Class="IndentedBulleted"><LI TYPE=DISC><FONT FACE="Arial, Helvetica">base</FONT>#<FONT FACE="Arial, Helvetica">based_numeral</FONT>.#[<FONT FACE="Arial, Helvetica">exponent</FONT>]</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>50</FONT></DIV>
<UL Class="IndentedBulleted"><LI TYPE=DISC><FONT FACE="Arial, Helvetica">base</FONT>#.<FONT FACE="Arial, Helvetica">based_numeral</FONT>#[<FONT FACE="Arial, Helvetica">exponent</FONT>]
</LI></UL>
<DIV Class="Paranum"><FONT SIZE=-2>51</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging"><A NAME="I1617"></A>with an optional leading sign
character (plus or minus), and if the corresponding numeric value belongs
to the base range of the type of S, then that value is the result; <A NAME="I1618"></A><A NAME="I1619"></A>otherwise
Constraint_Error is raised. The sign of a zero value is preserved (positive
if none has been specified) if S'Signed_Zeros is True.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>52</FONT></DIV>
<DL Class="Hanging" Style="margin-bottom: 0.4em"><DT> S'Value<DD Class="Hanging">
<A NAME="I1620"></A><A NAME="I1621"></A>S'Value denotes a function with
the following specification: </DL>
<DIV Class="Paranum"><FONT SIZE=-2>53</FONT></DIV>
<DIV Class="IndentedExamples"><TT><B>function</B> S'Value(<I>Arg</I> : String)<BR>
<B>return</B> S'Base</TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>54</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging">This function returns a value given an image of
the value as a String, ignoring any leading or trailing spaces.</DL>
<DIV Class="Paranum"><FONT SIZE=-2>55</FONT></DIV>
<DL Class="Hanging"><DD Class ="Hanging"><A NAME="I1622"></A><A NAME="I1623"></A>For the
evaluation of a call on S'Value for an enumeration subtype S, if the
sequence of characters of the parameter (ignoring leading and trailing
spaces) has the syntax of an enumeration literal and if it corresponds
to a literal of the type of S (or corresponds to the result of S'Image
for a value of the type), the result is the corresponding enumeration
value; <A NAME="I1624"></A><A NAME="I1625"></A>otherwise Constraint_Error
is raised. For a numeric subtype S, the evaluation of a call on S'Value
with <I>Arg</I> of type String is equivalent to a call on S'Wide_Value
for a corresponding <I>Arg</I> of type Wide_String. </DL>
<DIV Class="Paranum"><FONT SIZE=-2>55.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>S'Value is subtly
different from S'Wide_Value for enumeration subtypes since S'Image might
produce a different sequence of characters than S'Wide_Image if the enumeration
literal uses characters outside of the predefined type Character. That
is why we don't just define S'Value in terms of S'Wide_Value for enumeration
subtypes. S'Value and S'Wide_Value for numeric subtypes yield the same
result given the same sequence of characters. </FONT></DIV>
<H4 ALIGN=CENTER>Implementation Permissions</H4>
<DIV Class="Paranum"><FONT SIZE=-2>56</FONT></DIV>
<DIV Class="Normal"> An implementation may extend the Wide_Value,
[Value, Wide_Image, and Image] attributes of a floating point type to
support special values such as infinities and NaNs.</DIV>
<DIV Class="Paranum"><FONT SIZE=-2>56.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Proof: </B>The permission is
really only necessary for Wide_Value, because Value is defined in terms
of Wide_Value, and because the behavior of Wide_Image and Image is already
unspecified for things like infinities and NaNs. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>56.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Reason: </B>This is to allow
implementations to define full support for IEEE arithmetic. See also
the similar permission for Get in <A HREF="AA-A-10-9.html">A.10.9</A>.
</FONT></DIV>
<DIV Class="NotesHeader"><FONT SIZE=-1>NOTES</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>57</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>19 The evaluation of S'First
or S'Last never raises an exception. If a scalar subtype S has a nonnull
range, S'First and S'Last belong to this range. These values can, for
example, always be assigned to a variable of subtype S. </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>57.a</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><B>Discussion: </B>This paragraph
addresses an issue that came up with Ada 83, where for fixed point types,
the end points of the range specified in the type definition were not
necessarily within the base range of the type. However, it was later
clarified (and we reconfirm it in <A HREF="AA-3-5-9.html">3.5.9</A>,
``<A HREF="AA-3-5-9.html">Fixed Point Types</A>'') that the First and
Last attributes reflect the true bounds chosen for the type, not the
bounds specified in the type definition (which might be outside the ultimately
chosen base range). </FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>58</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>20 For a subtype of a scalar
type, the result delivered by the attributes Succ, Pred, and Value might
not belong to the subtype; similarly, the actual parameters of the attributes
Succ, Pred, and Image need not belong to the subtype.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>59</FONT></DIV>
<DIV Class="Notes"><FONT SIZE=-1>21 For any value V (including
any nongraphic character) of an enumeration subtype S, S'Value(S'Image(V))
equals V, as does S'Wide_Value(S'Wide_Image(V)). Neither expression ever
raises Constraint_Error. </FONT></DIV>
<H4 ALIGN=CENTER>Examples</H4>
<DIV Class="Paranum"><FONT SIZE=-2>60</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> <I>Examples of
ranges:</I> </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>61</FONT></DIV>
<DIV Class="Examples"><TT>-10 .. 10<BR>
X .. X + 1<BR>
0.0 .. 2.0*Pi<BR>
Red .. Green <I>-- see <A HREF="AA-3-5-1.html">3.5.1</A></I><BR>
1 .. 0 <I>-- a null range</I><BR>
Table'Range <I>-- a range attribute reference (see <A HREF="AA-3-6.html">3.6</A>)</I></TT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>62</FONT></DIV>
<DIV Class="Normal" Style="margin-bottom: 0.4em"> <I>Examples of
range constraints:</I> </DIV>
<DIV Class="Paranum"><FONT SIZE=-2>63</FONT></DIV>
<DIV Class="Examples"><TT><B>range</B> -999.0 .. +999.0<BR>
<B>range</B> S'First+1 .. S'Last-1</TT></DIV>
<H4 ALIGN=CENTER>Incompatibilities With Ada 83</H4>
<DIV Class="Paranum"><FONT SIZE=-2>63.a/1</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><A NAME="I1626"></A>S'Base is
no longer defined for nonscalar types. One conceivable existing use of
S'Base for nonscalar types is S'Base'Size where S is a generic formal
private type. However, that is not generally useful because the actual
subtype corresponding to S might be a constrained array or discriminated
type, which would mean that S'Base'Size might very well overflow (for
example, S'Base'Size where S is a constrained subtype of String will
generally be 8 * (Integer'Last + 1)). For derived discriminated types
that are packed, S'Base'Size might not even be well defined if the first
subtype is constrained, thereby allowing some amount of normally required
``dope'' to have been squeezed out in the packing. Hence our conclusion
is that S'Base'Size is not generally useful in a generic, and does not
justify keeping the attribute Base for nonscalar types just so it can
be used as a <U><FONT FACE="Arial, Helvetica">prefix</FONT></U><S>prefix</S>.</FONT></DIV>
<H4 ALIGN=CENTER>Extensions to Ada 83</H4>
<DIV Class="Paranum"><FONT SIZE=-2>63.b</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1><A NAME="I1627"></A>The attribute
S'Base for a scalar subtype is now permitted anywhere a <FONT FACE="Arial, Helvetica">subtype_mark</FONT>
is permitted. S'Base'First .. S'Base'Last is the base range of the type.
Using an <FONT FACE="Arial, Helvetica">attribute_definition_clause</FONT>,
one cannot specify any subtype-specific attributes for the subtype denoted
by S'Base (the base subtype).</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>63.c</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The attribute S'Range is now allowed
for scalar subtypes.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>63.d</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The attributes S'Min and S'Max
are now defined, and made available for all scalar types.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>63.e</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The attributes S'Succ, S'Pred,
S'Image, S'Value, and S'Width are now defined for real types as well
as discrete types.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>63.f</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>Wide_String versions of S'Image
and S'Value are defined. These are called S'Wide_Image and S'Wide_Value
to avoid introducing ambiguities involving uses of these attributes with
string literals. </FONT></DIV>
<H4 ALIGN=CENTER>Wording Changes from Ada 83</H4>
<DIV Class="Paranum"><FONT SIZE=-2>63.g</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>We now use the syntactic category
<FONT FACE="Arial, Helvetica">range_attribute_reference</FONT> since
it is now syntactically distinguished from other attribute references.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>63.h</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>The definition of S'Base has been
moved here from 3.3.3 since it now applies only to scalar types.</FONT></DIV>
<DIV Class="Paranum"><FONT SIZE=-2>63.i</FONT></DIV>
<DIV Class="Annotations"><FONT SIZE=-1>More explicit rules are provided
for nongraphic characters. </FONT></DIV>
<HR>
<P><A HREF="AA-TOC.html">Contents</A> <A HREF="AA-0-29.html">Index</A> <A HREF="AA-3-4-1.html">Previous</A> <A HREF="AA-3-5-1.html">Next</A> <A HREF="AA-TTL.html">Legal</A></P>
</BODY>
</HTML>
|