MISRA C:2012 8 Rules 8.1 A Standard C environment (Part 2)中,如何确保一个标准的C环境符合所有规定?

2026-04-16 21:432阅读0评论SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计800个文字,预计阅读时间需要4分钟。

MISRA C:2012 8 Rules 8.1 A Standard C environment (Part 2)中,如何确保一个标准的C环境符合所有规定?

0562赋值的右操作数指向更严格的类型+另一方面,使用类型为T的表达式初始化类型为const TYPE *或volatile TYPE *或甚至const volatile TYPE *的对象是完全合法的。

0562赋值的右操作数指向更严格的类型

On the other hand, it is perfectly legitimate(合法的) to initialize an object of type "const TYPE *" or "volatile TYPE *" or even "const volatile TYPE *" with an expression of type "TYPE *".

const int * a; 指向的内容是常量,指针本身可以变

MISRA C:2012 8 Rules 8.1 A Standard C environment (Part 2)中,如何确保一个标准的C环境符合所有规定?

int *b;

*b = 6;

a = b ; 合法, 以后不能通过指针a 修改,a所指向的内容

b = a; 不合法,b所指向的值可以随便改,与a的定义相悖。

阅读全文

本文共计800个文字,预计阅读时间需要4分钟。

MISRA C:2012 8 Rules 8.1 A Standard C environment (Part 2)中,如何确保一个标准的C环境符合所有规定?

0562赋值的右操作数指向更严格的类型+另一方面,使用类型为T的表达式初始化类型为const TYPE *或volatile TYPE *或甚至const volatile TYPE *的对象是完全合法的。

0562赋值的右操作数指向更严格的类型

On the other hand, it is perfectly legitimate(合法的) to initialize an object of type "const TYPE *" or "volatile TYPE *" or even "const volatile TYPE *" with an expression of type "TYPE *".

const int * a; 指向的内容是常量,指针本身可以变

MISRA C:2012 8 Rules 8.1 A Standard C environment (Part 2)中,如何确保一个标准的C环境符合所有规定?

int *b;

*b = 6;

a = b ; 合法, 以后不能通过指针a 修改,a所指向的内容

b = a; 不合法,b所指向的值可以随便改,与a的定义相悖。

阅读全文