From Jason Turner

[expr.sub]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpvpkl2hsz/{from.md → to.md} +21 -16
tmp/tmpvpkl2hsz/{from.md → to.md} RENAMED
@@ -1,24 +1,29 @@
1
  #### Subscripting <a id="expr.sub">[[expr.sub]]</a>
2
 
3
- A postfix expression followed by an expression in square brackets is a
4
- postfix expression. One of the expressions shall be a glvalue of type
5
- “array of `T`” or a prvalue of type “pointer to `T`” and the other shall
6
- be a prvalue of unscoped enumeration or integral type. The result is of
7
- type “`T`”. The type “`T`” shall be a completely-defined object
8
- type.[^11] The expression `E1[E2]` is identical (by definition) to
9
- `*((E1)+(E2))`, except that in the case of an array operand, the result
10
- is an lvalue if that operand is an lvalue and an xvalue otherwise. The
11
- expression `E1` is sequenced before the expression `E2`.
 
12
 
13
- [*Note 1*: A comma expression [[expr.comma]] appearing as the
14
- *expr-or-braced-init-list* of a subscripting expression is deprecated;
15
- see [[depr.comma.subscript]]. *end note*]
 
 
 
16
 
17
- [*Note 2*: Despite its asymmetric appearance, subscripting is a
 
 
 
 
18
  commutative operation except for sequencing. See  [[expr.unary]] and 
19
  [[expr.add]] for details of `*` and `+` and  [[dcl.array]] for details
20
  of array types. — *end note*]
21
 
22
- A *braced-init-list* shall not be used with the built-in subscript
23
- operator.
24
-
 
1
  #### Subscripting <a id="expr.sub">[[expr.sub]]</a>
2
 
3
+ A *subscript expression* is a postfix expression followed by square
4
+ brackets containing a possibly empty, comma-separated list of
5
+ *initializer-clause*s that constitute the arguments to the subscript
6
+ operator. The *postfix-expression* and the initialization of the object
7
+ parameter of any applicable subscript operator function is sequenced
8
+ before each expression in the *expression-list* and also before any
9
+ default argument. The initialization of a non-object parameter of a
10
+ subscript operator function `S` [[over.sub]], including every associated
11
+ value computation and side effect, is indeterminately sequenced with
12
+ respect to that of any other non-object parameter of `S`.
13
 
14
+ With the built-in subscript operator, an *expression-list* shall be
15
+ present, consisting of a single *assignment-expression*. One of the
16
+ expressions shall be a glvalue of type “array of `T`” or a prvalue of
17
+ type “pointer to `T`” and the other shall be a prvalue of unscoped
18
+ enumeration or integral type. The result is of type “`T`”. The type
19
+ “`T`” shall be a completely-defined object type.[^11]
20
 
21
+ The expression `E1[E2]` is identical (by definition) to `*((E1)+(E2))`,
22
+ except that in the case of an array operand, the result is an lvalue if
23
+ that operand is an lvalue and an xvalue otherwise.
24
+
25
+ [*Note 1*: Despite its asymmetric appearance, subscripting is a
26
  commutative operation except for sequencing. See  [[expr.unary]] and 
27
  [[expr.add]] for details of `*` and `+` and  [[dcl.array]] for details
28
  of array types. — *end note*]
29