N2912 Draft: Formally Terming "Array to Pointer Decay"

Skip to first unread message

arnab chatterjee

Jul 30, 2022, 8:00:44 AM7/30/22
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 "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 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".

Reply all
Reply to author
0 new messages