You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the expression P points to element x[i] of an array object x with n elements, the expressions P + J and J + P (where J has the value j) point to the (possibly-hypothetical) element x[i + j] if 0 ≤ i + j ≤ n; otherwise, the behavior is undefined.
Semicolon suggests that "otherwise" applies to the first clause of the compound sentence, to both preconditions: expression shall point to an element of an array object and the inequalities shall be satisfied. Therefore, if the first precondition is not met, the behavior is undefined.
But p7 allows adding the value 0 to a null pointer value, which, of course, does not point to an element of any array object.
The text was updated successfully, but these errors were encountered:
p5 has a related problem: "When two pointers to elements of the same array object are subtracted, the type of the result is an implementation-defined signed integral type; ..." This makes the type of the result somehow conditional on the operands pointing to elements of the same array object (which is a runtime condition). That can't work.
p4 says:
Semicolon suggests that "otherwise" applies to the first clause of the compound sentence, to both preconditions: expression shall point to an element of an array object and the inequalities shall be satisfied. Therefore, if the first precondition is not met, the behavior is undefined.
But p7 allows adding the value
0
to a null pointer value, which, of course, does not point to an element of any array object.The text was updated successfully, but these errors were encountered: