Liste des Groupes | Revenir à cl c |
On 29/01/2025 17:00, Ben Bacarisse wrote:Alexis <flexibeast@gmail.com> writes:>
JeanHeyd Meneide, a Project Editor for WG14, has just posted the resultsCurious. The top objection to the usual macro solution is given as:
of a survey re. the preferred form of a new array size operator:
>
-- https://thephd.dev/the-big-array-size-survey-for-c-results
* double-evaluation of e.g. getting the size of the 1-d part of a 2-d
array int meow[3][4]; /* ... */ SIZE_KEYWORD(meow[first_idx()]);
Does the author not know that there is no evaluation of the operands of
sizeof in this example?
6.5.3.4p2 :
>
"""
If the type of the operand is a variable length array type, the operand is
evaluated; otherwise, the operand is not evaluated and the result is an
integer constant.
"""
>
I don't know if that is the source of the double-evaluation concern here,
but it is certainly a situation in which sizeof /does/ evaluate its
operand.
Les messages affichés proviennent d'usenet.