void string_sort_quick(size_t size, char *array[static size])
{
string_sort(0, size - 1, array);
}
What exactly does static size
promise here? That there will be at least size pointers to char arrays; or that the pointers will point to char arrays of at least size length? Does static
in this context concern row or column?
Assuming it does concern columns (length of char arrays) – is there any way to express that there will be size pointers?
Edit/Answer
As DavidRanieri pointed out in the comments, it is to be understood as "At least size pointers to char arrays." Compiling with Clang supports this, as
static void func(char *array[static 2])
{
printf("%s\n", array[0]);
}
int main(void)
{
char *arr1[] = {"abc"};
func(arr1);
return 0;
}
will inform you that the array argument is too small; contains 1 elements, callee requires at least 2
. (GCC is silent about this, see GCC : Static array index in function argument doesn't trigger any warning).
Take note that static void func(size_t size, char *array[static size])
is a bad idea. Clang won't accept it, telling you that a parameter is not allowed
. GCC does not tell you what it thinks about any of it.