This diagnostic rule is based on the MISRA (Motor Industry Software Reliability Association) guidelines for software development.
This rule applies only to C. Identifiers with external linkage should be easily distinguished within the limitations imposed by the standard used.
The limitations are as follows:
Example 1:
// 123456789012345678901234567890123
extern int shrtfn(void); // OK
extern int longfuncname(void); // Error in C90,
// but OK in C99
extern int longlonglonglonglongfunctionname1(void); // Error in both
Long identifiers make it difficult to read code - and it's easy to confuse them with automatically generated identifiers. Also, when two identifiers differ only in characters that are not significant, this causes undefined behavior.
Some implementations of compilers and linkers can have their own limitations. To find out what these limitations are, refer to these tools' documentation.
Example 2:
// 123456789012345678901234567890123
extern int longFuncName1(int);
extern int longFuncName2(int);
extern int AAA;
extern int aaa;
void foo(void)
{
longFuncName2(AAA);
}
This code contains several errors at once (we'll examine this code based on the C90 standard):
This diagnostic is classified as:
|