I didn't expect to get any compiler warnings for code that passes NULL to a [static 1] parameter, so I wasn't surprised when this code compiled silently:
#include <stdio.h>
void end(int foo[static 1]) {
printf("%d\n", *foo);
}
void middle(int *foo) {
end(foo);
}
int main() {
middle(NULL);
return 0;
}
But I was a bit disappointed that the following compiled without warning as well: #include <stdio.h>
void end(int foo[static 1]) {
printf("%d\n", *foo);
}
int main() {
int *foo = NULL;
end(foo);
return 0;
}