Mercurial > hg > CbC > CbC_gcc
comparison gcc/ada/doc/gnat_rm/implementation_defined_attributes.rst @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1532 | 1532 |
1533 Attribute Valid_Scalars | 1533 Attribute Valid_Scalars |
1534 ======================= | 1534 ======================= |
1535 .. index:: Valid_Scalars | 1535 .. index:: Valid_Scalars |
1536 | 1536 |
1537 The ``'Valid_Scalars`` attribute is intended to make it easier to | 1537 The ``'Valid_Scalars`` attribute is intended to make it easier to check the |
1538 check the validity of scalar subcomponents of composite objects. It | 1538 validity of scalar subcomponents of composite objects. The attribute is defined |
1539 is defined for any prefix ``X`` that denotes an object. | 1539 for any prefix ``P`` which denotes an object. Prefix ``P`` can be any type |
1540 The value of this attribute is of the predefined type Boolean. | 1540 except for tagged private or ``Unchecked_Union`` types. The value of the |
1541 ``X'Valid_Scalars`` yields True if and only if evaluation of | 1541 attribute is of type ``Boolean``. |
1542 ``P'Valid`` yields True for every scalar part P of X or if X has | 1542 |
1543 no scalar parts. It is not specified in what order the scalar parts | 1543 ``P'Valid_Scalars`` yields ``True`` if and only if the evaluation of |
1544 are checked, nor whether any more are checked after any one of them | 1544 ``C'Valid`` yields ``True`` for every scalar subcomponent ``C`` of ``P``, or if |
1545 is determined to be invalid. If the prefix ``X`` is of a class-wide | 1545 ``P`` has no scalar subcomponents. Attribute ``'Valid_Scalars`` is equivalent |
1546 type ``T'Class`` (where ``T`` is the associated specific type), | 1546 to attribute ``'Valid`` for scalar types. |
1547 or if the prefix ``X`` is of a specific tagged type ``T``, then | 1547 |
1548 only the scalar parts of components of ``T`` are traversed; in other | 1548 It is not specified in what order the subcomponents are checked, nor whether |
1549 words, components of extensions of ``T`` are not traversed even if | 1549 any more are checked after any one of them is determined to be invalid. If the |
1550 ``T'Class (X)'Tag /= T'Tag`` . The compiler will issue a warning if it can | 1550 prefix ``P`` is of a class-wide type ``T'Class`` (where ``T`` is the associated |
1551 be determined at compile time that the prefix of the attribute has no | 1551 specific type), or if the prefix ``P`` is of a specific tagged type ``T``, then |
1552 scalar parts (e.g., if the prefix is of an access type, an interface type, | 1552 only the subcomponents of ``T`` are checked; in other words, components of |
1553 an undiscriminated task type, or an undiscriminated protected type). | 1553 extensions of ``T`` are not checked even if ``T'Class (P)'Tag /= T'Tag``. |
1554 | 1554 |
1555 For scalar types, ``Valid_Scalars`` is equivalent to ``Valid``. The use | 1555 The compiler will issue a warning if it can be determined at compile time that |
1556 of this attribute is not permitted for ``Unchecked_Union`` types for which | 1556 the prefix of the attribute has no scalar subcomponents. |
1557 in general it is not possible to determine the values of the discriminants. | 1557 |
1558 | 1558 Note: ``Valid_Scalars`` can generate a lot of code, especially in the case of |
1559 Note: ``Valid_Scalars`` can generate a lot of code, especially in the case | 1559 a large variant record. If the attribute is called in many places in the same |
1560 of a large variant record. If the attribute is called in many places in the | 1560 program applied to objects of the same type, it can reduce program size to |
1561 same program applied to objects of the same type, it can reduce program size | 1561 write a function with a single use of the attribute, and then call that |
1562 to write a function with a single use of the attribute, and then call that | |
1563 function from multiple places. | 1562 function from multiple places. |
1564 | 1563 |
1565 Attribute VADS_Size | 1564 Attribute VADS_Size |
1566 =================== | 1565 =================== |
1567 .. index:: Size, VADS compatibility | 1566 .. index:: Size, VADS compatibility |