MISRA C:2012 8 Rules 8.5 Identifiers 标识符

3334 This declaration of '%s' hides a more global declaration.

extern int press;

void foo(void)
{
    float press;               /* Message 3334 */
}

3448 Declaration of typedef '%s' is not in a header file although it is used in a definition or declaration with external linkage.

typedef int TYPE;         /* Message 3448 */
extern TYPE foo(void);    /* Message 3447 */

extern TYPE foo(void)
{
    return 1;
}

1525 Object/function with external linkage has same identifier as another object/function with internal linkage.

file1.cpp
=======
extern int contr;    // Message 1525 

file2.cpp
=======
static int contr;    // Message 1525

这种写法是合法的,但是不建议这么写,如果上述代码写在同一个文件中,会报错。

1526 Object with no linkage has same identifier as another object/function with external linkage.重名错误

file1.cpp
=======
extern int remake;    // Message 1526 

file2.cpp
=======
void foo(void)
{
    int remake;      // Message 1526 
    ...
}

1527 Object/function with internal linkage has same identifier as another object/function with internal linkage.

file1.cpp
=======
static int cra;    // Message 1527

file2.cpp
=======
static int cra;    // Message 1527

这么写合法,但是不建议这么写

1528 Object with no linkage has same identifier as another object/function with internal linkage.

file1.cpp
=======
static int cra;    // Message 1528 

file2.cpp
=======
void foo(void)
{
    int cra;       // Message 1528 
    ...
}
原文地址:https://www.cnblogs.com/focus-z/p/11666680.html