Issue 1116: Requirements on array parameters

Authors: Jay Ghiron
Date: 2026-09-29
Submitted against: C23
Status: Open

If a function argument is described as being an array, the pointer passed to the function shall have a value such that all address computations and accesses to objects (that would be valid if the pointer did point to the first element of such an array) are valid.

(C23 7.1.4 "Use of library functions" paragraph 1.)

This wording is not very clear about what counts as being an array. Some functions such as encodedecd32 are specified with array parameter types, so they are clearly included. Other functions such as the <string.h> functions are described as being required to point to arrays so they are clearly included:

Various methods are used for determining the lengths of the arrays, but in all cases a char * or void * argument points to the initial (lowest addressed) character of the array. If an array is accessed beyond the end of an object, the behavior is undefined.

(C23 7.26.1 "String function conventions" paragraph 1.)

However, there are less clear cases such as %s in a call to a *printf function which are not explicitly described as being an array. Which makes it unclear if %s can be provided a pointer to storage without a null terminator if a conversion failure occurred earlier. There are also cases such as mbsrtowcs which indirectly access an array, so the wording does not appear to apply to them. Perhaps it would make more sense to talk about arrays accessed using a function argument, rather than the function argument being an array.