Two or more incompatible declarations of the same function or object that appear in the same program shall be diagnosed because they result in undefined behavior.
The C standard [ISO/IEC 9899:2011] identifies three distinct situations in which undefined behavior (UB) may arise as a result of incompatible declarations of the same function or object:
...
Code Block | ||||
---|---|---|---|---|
| ||||
/* a.c: */ int x = 0; /* the definition */ /* b.c: */ extern char x; /* incompatible declaration */ /* but no other references to 'x' */ |
Related Guidelines
ARR31-C. Use consistent array notation across all source files
ISO/IEC 9899:2011 Section 6.7.6.2, "Array declarators," and Section 6.2.2, "Linkages of identifiers"
Bibliography
[Hatton 1995] Section 2.8.3
...