Liste des Groupes | Revenir à cl c |
On 12.05.2025 17:08, David Brown wrote:On 11/05/2025 23:43, James Kuyper wrote:[...]>More precisely, it makes it undefined behavior for values to point to an
array of less than 10 doubles.
The wording of the C standard (C11, as that's what I have open at the
moment) is :
"""
If the keyword static also appears within the [ and ] of the array type
derivation, then for each call to the function, the value of the
corresponding actual argument shall provide access to the first element
of an array with at least as many elements as specified by the size
expression.
"""
Oh! - This is somewhat surprising to me. - When I first read about
the "arr[static N]" I assumed that it would be possible to pass any
sub-array, say "&arr[8]" (or "arr+8") as long as it's large enough
to still have N elements from the starting point, but the quote says
explicitly "access to the _first_ element of an array" (which I'd
interpret as "&arr[0]" (or "arr"). - Unless I misinterpreted that;
what would be the reason for that?
Les messages affichés proviennent d'usenet.