From Jason Turner

[expr.rel]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpyvrh84d1/{from.md → to.md} +12 -12
tmp/tmpyvrh84d1/{from.md → to.md} RENAMED
@@ -12,28 +12,28 @@ relational-expression:
12
  relational-expression '>' compare-expression
13
  relational-expression '<=' compare-expression
14
  relational-expression '>=' compare-expression
15
  ```
16
 
17
- The lvalue-to-rvalue [[conv.lval]], array-to-pointer [[conv.array]], and
18
- function-to-pointer [[conv.func]] standard conversions are performed on
19
- the operands. The comparison is deprecated if both operands were of
20
- array type prior to these conversions [[depr.array.comp]].
21
 
22
  The converted operands shall have arithmetic, enumeration, or pointer
23
  type. The operators `<` (less than), `>` (greater than), `<=` (less than
24
  or equal to), and `>=` (greater than or equal to) all yield `false` or
25
  `true`. The type of the result is `bool`.
26
 
27
  The usual arithmetic conversions [[expr.arith.conv]] are performed on
28
- operands of arithmetic or enumeration type. If both operands are
29
- pointers, pointer conversions [[conv.ptr]] and qualification conversions
30
- [[conv.qual]] are performed to bring them to their composite pointer
31
- type [[expr.type]]. After conversions, the operands shall have the same
32
- type.
33
 
34
- The result of comparing unequal pointers to objects[^30]
35
 
36
  is defined in terms of a partial order consistent with the following
37
  rules:
38
 
39
  - If two pointers point to different elements of the same array, or to
@@ -53,12 +53,12 @@ a pointer to object `p` compares greater than a pointer `q`, `p>=q`,
53
  `p>q`, `q<=p`, and `q<p` all yield `true` and `p<=q`, `p<q`, `q>=p`, and
54
  `q>p` all yield `false`. Otherwise, the result of each of the operators
55
  is unspecified.
56
 
57
  [*Note 1*: A relational operator applied to unequal function pointers
58
- or to unequal pointers to `void` yields an unspecified
59
- result. — *end note*]
60
 
61
  If both operands (after conversions) are of arithmetic or enumeration
62
  type, each of the operators shall yield `true` if the specified
63
  relationship is true and `false` if it is false.
64
 
 
12
  relational-expression '>' compare-expression
13
  relational-expression '<=' compare-expression
14
  relational-expression '>=' compare-expression
15
  ```
16
 
17
+ The lvalue-to-rvalue [[conv.lval]] and function-to-pointer [[conv.func]]
18
+ standard conversions are performed on the operands. If one of the
19
+ operands is a pointer, the array-to-pointer conversion [[conv.array]] is
20
+ performed on the other operand.
21
 
22
  The converted operands shall have arithmetic, enumeration, or pointer
23
  type. The operators `<` (less than), `>` (greater than), `<=` (less than
24
  or equal to), and `>=` (greater than or equal to) all yield `false` or
25
  `true`. The type of the result is `bool`.
26
 
27
  The usual arithmetic conversions [[expr.arith.conv]] are performed on
28
+ operands of arithmetic or enumeration type. If both converted operands
29
+ are pointers, pointer conversions [[conv.ptr]], function pointer
30
+ conversions [[conv.fctptr]], and qualification conversions [[conv.qual]]
31
+ are performed to bring them to their composite pointer type
32
+ [[expr.type]]. After conversions, the operands shall have the same type.
33
 
34
+ The result of comparing unequal pointers to objects[^27]
35
 
36
  is defined in terms of a partial order consistent with the following
37
  rules:
38
 
39
  - If two pointers point to different elements of the same array, or to
 
53
  `p>q`, `q<=p`, and `q<p` all yield `true` and `p<=q`, `p<q`, `q>=p`, and
54
  `q>p` all yield `false`. Otherwise, the result of each of the operators
55
  is unspecified.
56
 
57
  [*Note 1*: A relational operator applied to unequal function pointers
58
+ yields an unspecified result. A pointer value of type “pointer to
59
+ cv `void`” can point to an object [[basic.compound]]. — *end note*]
60
 
61
  If both operands (after conversions) are of arithmetic or enumeration
62
  type, each of the operators shall yield `true` if the specified
63
  relationship is true and `false` if it is false.
64