...
Code Block | ||||
---|---|---|---|---|
| ||||
/* in another source file */ void copy(char *dst, const char *src) { if (!strcpy(dst, src)) { /* report error */ } } /* copy prototype in scope in this source file */ void copy(char *dst, const char *src); void g(const char *s) { char buf[20]; copy(buf, s); /* ... */ } |
Noncompliant Code Example
...
Code Block | ||||
---|---|---|---|---|
| ||||
/* in another source file */ void buginf(const char *fmt, ...) { /* ... */ } /* buginf prototype in scope in this source file */ void buginf(const char *fmt, ...); void h(void) { buginf("bug in function %s, line %d\n", __func__, __LINE__); /* ... */ } |
...
Noncompliant Code Example
...
Code Block | ||||
---|---|---|---|---|
| ||||
/* in another source file */
long f(long x) {
return x < 0 ? -x : x;
}
/* f prototype in scope in this source file */
long f(long x);
int g(long x) {
return f(x);
}
|
...
Noncompliant Code Example (POSIX)
...