A question for Rule8.13 - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4) +--- Forum: MISRA C:2012 and MISRA C:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=21) +---- Forum: 8.8 Declarations and defnitions (https://forum.misra.org.uk/forumdisplay.php?fid=163) +---- Thread: A question for Rule8.13 (/showthread.php?tid=1030) |
A question for Rule8.13 - KumikoItoh - 25-02-2014 I have a question for the Rule8.13. The rule8.13 is A pointer should point to a const-qualified type whenever possible A pointer parameter in a function prototype should be declared as pointer to const if the pointer is not used to modify the addressed object However, target of the rule16.7 on MISRAC-2004 is "pointer parameter in a fuction". Why do you delete "pointer parameter in a function"? Please tell me the reason. Best Regards, Kumiko Itoh Re: A question for Rule8.13 - misra-c - 20-03-2014 Rule 8.13 covers all pointers, which includes the "pointer parameter to function" that was covered by rule 16.7 in MISRA-C:2004. It was felt that programmers should be encouraged to use const where possible and not just on function parameters. Code: int32_t fn ( int32_t *ptr ) /* not compliant */ |