zoukankan      html  css  js  c++  java
  • 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 
        ...
    }
  • 相关阅读:
    C# -- 使用缓冲区进行文件下载操作
    C# -- 使用ODBC连接数据库
    C# -- Quartz.Net入门案例
    C# -- LinkedList的使用
    ASP.NET -- 获取浏览器信息
    Windows -- 从注册表删除IE浏览器加载项
    C# -- FTP上传下载
    C# -- 使用Ping检查网络是否正常
    WinForm -- 为TextBox文本框添加鼠标右键菜单
    C# -- 使用Parallel并行执行任务
  • 原文地址:https://www.cnblogs.com/focus-z/p/11666680.html
Copyright © 2011-2022 走看看