I have a question about the behavior of the address-of operator followed by a dereference operator.
Let\'s take a look at the expression &*p
where
Consider that the conversion from array to pointer-to-first-element happens separately and before the application of *
. Although the decision about whether to convert the array to a pointer is not made until the C implementation determines whether it is the operand of sizeof
or &
(per C 2018 6.3.2.1 3), this conversion is not part of the *
operation. Thus, by the time we are examining &*
, the operand must already be a pointer.
Furthermore, a constraint on the operand of the *
operator is that it shall have pointer type (C 2018 6.5.3.2 2). Therefore, the operand must be a pointer, not an array.
The phrasing “the result is as if both were omitted” motivates us to consider what the result would be if both were omitted, but the text goes on to say “except that the constraints on the operators still apply and the result is not an lvalue.” Since the constraints still apply, the operand must be a pointer; it is not logically consistent that the constraint could apply and the operand could be an array that has not been converted to a pointer.