By the way, one thing that came up for me last week was that we probably ought to mention conformant array parameters. For example,
int f(size_t n, int a[n])
is a handy way to document the size of an array parameter.
Noncompliant Code Example
void my_memset(char* p, size_t n, char v) { memset( p, v, n); }
Noncompliant Code Example
This doesn't compile because n
is used before being declared.
void my_memset(char p[n], size_t n, char v) { memset( p, v, n); }
Compliant Solution
void my_memset(size_t n, char p[n], char v) { memset( p, v, n); }
Bibliography
C99, section 6.7.6.3 (see example 4)