Sujet : Re: technology discussion → does the world need a "new" C ?
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 06. Jul 2024, 23:45:40
Autres entêtes
Organisation : None to speak of
Message-ID : <87cynquokr.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7 8
User-Agent : Gnus/5.13 (Gnus v5.13)
James Kuyper <
jameskuyper@alumni.caltech.edu> writes:
[...]
The key point is that an expression of array type does not always get
converted into a pointer to the first element of that array. The clause
above starts out with four exceptions, and an array behaves quite
differently from a pointer when any of those exceptions apply.
There are three exceptions, not four.
The N1570 draft of C11 incorrectly says:
Except when it is the operand of the sizeof operator, the
_Alignof operator, 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. If the array
object has register storage class, the behavior is undefined.
There error is that the _Alignof operator (which was added in C11) can
only be applied to a parenthesized type name, not to an expression (I'm
not sure why that is). The C11 standard corrects the error, showing
just the usual three exceptions.
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */