N2912 Draft: Formally Terming "Array to Pointer Decay"

16 views
Skip to first unread message

arnab chatterjee

unread,
Jul 30, 2022, 8:00:44 AMJul 30
to
Hello all,

The C2x working draft <www.open-std.org/jtc1/sc22/wg14/www/docs/n2912.pdf> uses the phrase "array to pointer decay" in example 6 of section 6.7.2.5: "Nested typeof operators, arrays, and pointers do not perform array to pointer decay".

Even though most programmers are well-familiar with this, the standard only describes the behavior without associating the precise term; section 6.3.2.1 states:
Except when it is the operand of the sizeof operator, or typeof operators, or the unary & operator, or is a string literal used to initialize an array, an expression that has type "array of type" is converted to an expression with type "pointer to type" that points to the initial element of the array object and is not an lvalue.

The above text could have a small descriptive footnote, something along the lines of:
This conversion is sometimes called "array to pointer decay".

Regards,
cHaR.
Reply all
Reply to author
Forward
0 new messages