tmp/tmplgwiccps/{from.md → to.md}
RENAMED
|
@@ -10,79 +10,42 @@ relational-expression:
|
|
| 10 |
relational-expression '>' shift-expression
|
| 11 |
relational-expression '<=' shift-expression
|
| 12 |
relational-expression '>=' shift-expression
|
| 13 |
```
|
| 14 |
|
| 15 |
-
The operands shall have arithmetic, enumeration, or pointer type
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
|
| 20 |
The usual arithmetic conversions are performed on operands of arithmetic
|
| 21 |
-
or enumeration type.
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
constant, the composite pointer type is `std::nullptr_t` if the other
|
| 27 |
-
operand is also a null pointer constant or, if the other operand is a
|
| 28 |
-
pointer, the type of the other operand. Otherwise, if one of the
|
| 29 |
-
operands has type “pointer to *cv1* `void`,” then the other has type
|
| 30 |
-
“pointer to *cv2* *T*” and the composite pointer type is “pointer to
|
| 31 |
-
*cv12* `void`,” where *cv12* is the union of *cv1* and *cv2*. Otherwise,
|
| 32 |
-
the composite pointer type is a pointer type similar ([[conv.qual]]) to
|
| 33 |
-
the type of one of the operands, with a cv-qualification signature (
|
| 34 |
-
[[conv.qual]]) that is the union of the cv-qualification signatures of
|
| 35 |
-
the operand types. this implies that any pointer can be compared to a
|
| 36 |
-
null pointer constant and that any object pointer can be compared to a
|
| 37 |
-
pointer to (possibly cv-qualified) `void`.
|
| 38 |
|
| 39 |
-
|
| 40 |
-
void *p;
|
| 41 |
-
const int *q;
|
| 42 |
-
int **pi;
|
| 43 |
-
const int *const *pci;
|
| 44 |
-
void ct() {
|
| 45 |
-
p <= q; // Both converted to const void* before comparison
|
| 46 |
-
pi <= pci; // Both converted to const int *const * before comparison
|
| 47 |
-
}
|
| 48 |
-
```
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
same array or to different functions, or if only one of them is null,
|
| 60 |
-
the results of `p<q`, `p>q`, `p<=q`, and `p>=q` are unspecified.
|
| 61 |
-
- If two pointers point to non-static data members of the same object,
|
| 62 |
-
or to subobjects or array elements of such members, recursively, the
|
| 63 |
-
pointer to the later declared member compares greater provided the two
|
| 64 |
-
members have the same access control (Clause [[class.access]]) and
|
| 65 |
-
provided their class is not a union.
|
| 66 |
-
- If two pointers point to non-static data members of the same object
|
| 67 |
-
with different access control (Clause [[class.access]]) the result is
|
| 68 |
-
unspecified.
|
| 69 |
-
- If two pointers point to non-static data members of the same union
|
| 70 |
-
object, they compare equal (after conversion to `void*`, if
|
| 71 |
-
necessary). If two pointers point to elements of the same array or one
|
| 72 |
-
beyond the end of the array, the pointer to the object with the higher
|
| 73 |
-
subscript compares higher.
|
| 74 |
-
- Other pointer comparisons are unspecified.
|
| 75 |
-
|
| 76 |
-
Pointers to `void` (after pointer conversions) can be compared, with a
|
| 77 |
-
result defined as follows: If both pointers represent the same address
|
| 78 |
-
or are both the null pointer value, the result is `true` if the operator
|
| 79 |
-
is `<=` or `>=` and `false` otherwise; otherwise the result is
|
| 80 |
-
unspecified.
|
| 81 |
-
|
| 82 |
-
If two operands of type `std::nullptr_t` are compared, the result is
|
| 83 |
-
`true` if the operator is `<=` or `>=`, and `false` otherwise.
|
| 84 |
|
| 85 |
If both operands (after conversions) are of arithmetic or enumeration
|
| 86 |
type, each of the operators shall yield `true` if the specified
|
| 87 |
relationship is true and `false` if it is false.
|
| 88 |
|
|
|
|
| 10 |
relational-expression '>' shift-expression
|
| 11 |
relational-expression '<=' shift-expression
|
| 12 |
relational-expression '>=' shift-expression
|
| 13 |
```
|
| 14 |
|
| 15 |
+
The operands shall have arithmetic, enumeration, or pointer type. The
|
| 16 |
+
operators `<` (less than), `>` (greater than), `<=` (less than or equal
|
| 17 |
+
to), and `>=` (greater than or equal to) all yield `false` or `true`.
|
| 18 |
+
The type of the result is `bool`.
|
| 19 |
|
| 20 |
The usual arithmetic conversions are performed on operands of arithmetic
|
| 21 |
+
or enumeration type. If both operands are pointers, pointer
|
| 22 |
+
conversions ([[conv.ptr]]) and qualification conversions (
|
| 23 |
+
[[conv.qual]]) are performed to bring them to their composite pointer
|
| 24 |
+
type (Clause [[expr]]). After conversions, the operands shall have the
|
| 25 |
+
same type.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
+
Comparing pointers to objects is defined as follows:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
+
- If two pointers point to different elements of the same array, or to
|
| 30 |
+
subobjects thereof, the pointer to the element with the higher
|
| 31 |
+
subscript compares greater.
|
| 32 |
+
- If one pointer points to an element of an array, or to a subobject
|
| 33 |
+
thereof, and another pointer points one past the last element of the
|
| 34 |
+
array, the latter pointer compares greater.
|
| 35 |
+
- If two pointers point to different non-static data members of the same
|
| 36 |
+
object, or to subobjects of such members, recursively, the pointer to
|
| 37 |
+
the later declared member compares greater provided the two members
|
| 38 |
+
have the same access control (Clause [[class.access]]) and provided
|
| 39 |
+
their class is not a union.
|
| 40 |
|
| 41 |
+
If two operands `p` and `q` compare equal ([[expr.eq]]), `p<=q` and
|
| 42 |
+
`p>=q` both yield `true` and `p<q` and `p>q` both yield `false`.
|
| 43 |
+
Otherwise, if a pointer `p` compares greater than a pointer `q`, `p>=q`,
|
| 44 |
+
`p>q`, `q<=p`, and `q<p` all yield `true` and `p<=q`, `p<q`, `q>=p`, and
|
| 45 |
+
`q>p` all yield `false`. Otherwise, the result of each of the operators
|
| 46 |
+
is unspecified.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
If both operands (after conversions) are of arithmetic or enumeration
|
| 49 |
type, each of the operators shall yield `true` if the specified
|
| 50 |
relationship is true and `false` if it is false.
|
| 51 |
|