MISRA C Rule­6.1 0635 Rule­7.2 1281

 时间:2026-04-22 08:38:17

struct/union中的位域被声明为除int、signed int或unsigned int外的其他类型 ;

整型常量是无符号类型,但没有使用后缀符'U' 。

工具/原料

Rule­6.1 0635 Rule­7.2 1281

MISRA C:2012

Rule­6.1 0635

规则与等级对应关系(QAC)

MISRA C Rule­6.1 0635 Rule­7.2 1281

0635 [E] Bit-fields in this struct/union have been declared with types other than int, signed int or unsigned int. 

struct/union中的位域被声明为除int、signed int或unsigned int外的其他类型

根据ISO:C 标准,位域只能定义为以下类型: 

int/unsigned int/signed int。

有些编译器支持一些其他整型,比如char,short和enum。这属于语言的扩展,且是不可移植的。

在struct或union声明中,无论含有多少非标准位域,消息0635只会生成一次。

MISRA C Rule­6.1 0635 Rule­7.2 1281

编程规范修改举例

MISRA C Rule­6.1 0635 Rule­7.2 1281

Rule­7.2 1281

规则与等级对应关系(QAC)

MISRA C Rule­6.1 0635 Rule­7.2 1281

1281 Integer literal constant is of an unsigned type but does not include a "U" suffix. 

这是整型常量是无符号类型,但没有使用后缀符 'U' 。

注意:一个整数常量的类型,依赖于常量的值大小、'int' 型被实现的大小(即是说 'int' 型是16位还是32位)以及出现的后缀符。

官方示例

MISRA C Rule­6.1 0635 Rule­7.2 1281

编程规范修改举例

MISRA C Rule­6.1 0635 Rule­7.2 1281

  • 如何快速找到萝卜快跑软件上意见反馈的入口?
  • LOL手游涂鸦怎么获取
  • 怎样让孩子早点上床睡觉
  • 这些花卉不要再在室内养了,放时间长了会损害你的健康!
  • 疯狂猜成语3 开卷有益第111关攻略答案
  • 热门搜索
    网络营销推广方法 怎么注册网站 手链的编法大全 农村别墅设计图纸及效果图大全 怎么赚q币 玉米排骨汤怎么做 怎么删除页眉的横线 月经疼痛怎么缓解 工囗囗番漫画大全全彩 脸部祛斑方法