、 传入函数的实参是字符串,函数的形参不 是'pointer to const'类型; 把字符串赋给一个不是'pointer to const'类 型的指针。
工具/原料
Rule7.4 0752 0753
MISRA C:2012
Rule7.4 0752
1、规则与等级对应关系(QAC)

2、 0752 String literal passed as argument to function whose parameter is not a 'pointer to const'.字符串是'pointer to array of char'类型,而不是'pointer to array of const char'类型。这是C语言的一个缺点(历史原因)。通过字符串实现的字符数组应该永远不被修改,任何这样的操作都会导致未定义的行为。
3、官方示例

4、编程规范修改举例

Rule7.4 0753

2、 0753 String literal assigned to pointer which is not a 'pointer to const'. 把一个字符串'赋值'给一个'指针',而这个指针不是被定义成'pointer to const'类型。
3、编程规范修改举例
