Here is a code snippet similar to one we are doing, which triggers MISRA-C 2023 10.1 . Using cppcheckpremium 24.11.0
Rule 10.1 is about essential types operands, whereas pointers types are provided by rules 18.x .
What are we missing here?
typedefstructpt_foo_s{uint32_taa;uint16_tbb;uint8_tcc}pt_foo_t;typedefstructpt_bar_s{pt_foo_t*foos;uint16_tfoos_num;}pt_bar_t;intmain(){pt_bar_tbar;bar.foos=(pt_foo_t*)0xf00;bar.foos_num=10u;// the below line sounds premium-misra-c-2023-10.1for(pt_foo_t*foo=bar->foos;foo<bar->foos+bar->foos_num;++foo){// whatever}return0;}
Last edit: Morag Agmon 2024-12-29
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello
Here is a code snippet similar to one we are doing, which triggers MISRA-C 2023 10.1 . Using cppcheckpremium 24.11.0
Rule 10.1 is about essential types operands, whereas pointers types are provided by rules 18.x .
What are we missing here?
Last edit: Morag Agmon 2024-12-29