...
In this noncompliant code example, the length of the identifier declaring the function pointer bash_groupname_completion_function()
in file bashline.h
exceeds by 3 the minimum implementation limit of 31 significant initial characters in an external identifier, introducing the possibility of colliding with the bash_groupname_completion_func
integer variable defined in file b.c
, which is exactly 30 characters long. On an implementation that exactly meets this limit, the behavior of the program is undefined (see undefined behavior 15). In addition, invoking the function leads to undefined behavior 41 with typically catastrophic effects.
...
Code Block | ||||
---|---|---|---|---|
| ||||
/* a.c: */ int x = 0; /* the definition */ /* b.c: */ extern char x; /* incompatible declaration */ /* but no other references to 'x' */ |
Related Guidelines
CERT C Secure Coding Standard | ARR31-C. Use consistent array notation across all source files |
ISO/IEC TS 17961 (Draft) | Declaring the same function or object in incompatible ways [funcdecl] |
Bibliography
[Hatton 1995] | Section 2.8.3 |