tmp/tmpwfcw5rga/{from.md → to.md}
RENAMED
|
@@ -1,9 +1,11 @@
|
|
| 1 |
## Relational operators <a id="expr.rel">[[expr.rel]]</a>
|
| 2 |
|
| 3 |
-
The relational operators group left-to-right.
|
| 4 |
-
|
|
|
|
|
|
|
| 5 |
|
| 6 |
``` bnf
|
| 7 |
relational-expression:
|
| 8 |
shift-expression
|
| 9 |
relational-expression '<' shift-expression
|
|
@@ -22,23 +24,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
|
|
|
|
| 1 |
## Relational operators <a id="expr.rel">[[expr.rel]]</a>
|
| 2 |
|
| 3 |
+
The relational operators group left-to-right.
|
| 4 |
+
|
| 5 |
+
[*Example 1*: `a<b<c` means `(a<b)<c` and *not*
|
| 6 |
+
`(a<b)&&(b<c)`. — *end example*]
|
| 7 |
|
| 8 |
``` bnf
|
| 9 |
relational-expression:
|
| 10 |
shift-expression
|
| 11 |
relational-expression '<' shift-expression
|
|
|
|
| 24 |
conversions ([[conv.ptr]]) and qualification conversions (
|
| 25 |
[[conv.qual]]) are performed to bring them to their composite pointer
|
| 26 |
type (Clause [[expr]]). After conversions, the operands shall have the
|
| 27 |
same type.
|
| 28 |
|
| 29 |
+
Comparing unequal pointers to objects [^26] is defined as follows:
|
| 30 |
|
| 31 |
- If two pointers point to different elements of the same array, or to
|
| 32 |
subobjects thereof, the pointer to the element with the higher
|
| 33 |
subscript compares greater.
|
|
|
|
|
|
|
|
|
|
| 34 |
- If two pointers point to different non-static data members of the same
|
| 35 |
object, or to subobjects of such members, recursively, the pointer to
|
| 36 |
the later declared member compares greater provided the two members
|
| 37 |
have the same access control (Clause [[class.access]]) and provided
|
| 38 |
their class is not a union.
|
| 39 |
+
- Otherwise, neither pointer compares greater than the other.
|
| 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
|