C99 added static to the function parameter (only the value in the function definition, not the declaration):
void func( int a[static 10] ) { if ( a == NULL ) { } printf("%d", a[-1]); }
However, its value is defined in C11 6.7.6.3/7 as semantic and not a limitation, which means that the compiler should not issue diagnostics if the function is called incorrectly. In fact, the compiler should not interrupt compilation if it cannot prove that UB is called in all branches. For instance:
int main() { func(NULL);
Why did the standard not make this restriction (therefore requires diagnostics)?
Secondary question: why is static ignored in the prototype (6.7.6.3/13) instead of being part of the function signature? It seems to be misleading that the prototype contains it, but the body of the function does not, and vice versa.
source share