主要内容

本页翻译不是最新的。点击此处可查看最新英文版本。

MISRA C:2012 Rule 1.2

Language extensions should not be used

描述

规则定义

Language extensions should not be used 1 .

理由

如果程序使用语言扩展,则其可移植性就会降低。即使您记录了这些语言扩展,该文档也可能无法描述所有情况下的行为。

Polyspace 实现

此规则检查项会根据分析中使用的 C 标准版本标记这些语言扩展。请参阅 C 标准版本 (-c-version)

  • C90:

    • 包括常量的 long long int 类型

    • long double 类型

    • inline 关键字

    • _Bool 关键字

    • 十六进制浮点常量

    • 指定初始化函数

    • 局部标签声明

    • typeof 运算符

    • 转换为并集

    • 复合字面值

    • 表达式中的语句和声明

    • __func__ 预定义标识符

    • _Pragma 预处理运算符

    • 具有可变参量列表的宏

    • asm 函数

    • 匿名并集

    • struct

  • C99:

    • short long int 类型

    • 局部标签声明

    • typeof 运算符

    • 转换为并集

    • 表达式中的语句和声明

    • asm 函数

    • 匿名并集

    • struct

故障排除

如果您预计存在违规,但未看到该违规,请参阅Diagnose Why Coding Standard Violations Do Not Appear as Expected

检查信息

组:标准 C 环境
类别:建议
AGC 类别:建议

版本历史记录

在 R2014b 中推出

全部展开


1 All MISRA coding rules and directives are © Copyright The MISRA Consortium Limited 2021.

The MISRA coding standards referenced in the Polyspace Bug Finder™ documentation are from the following MISRA standards:

  • MISRA C:2004

  • MISRA C:2012

  • MISRA C:2023

  • MISRA C++:2008

  • MISRA C++:2023

MISRA and MISRA C are registered trademarks of The MISRA Consortium Limited 2021.