Rule 18.8 and clarification of "use" of VLA types - 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.18 Pointers and arrays (https://forum.misra.org.uk/forumdisplay.php?fid=173) +---- Thread: Rule 18.8 and clarification of "use" of VLA types (/showthread.php?tid=1384) |
Rule 18.8 and clarification of "use" of VLA types - rgamble - 27-10-2017 What exactly is meant by the "use" of "variable-length array types"? The examples suggest that the mere declaration of an object of variable length array type violates this rule which makes sense if the declaration is thought of as "using" the VLA type. The example below declares a pointer to a VLA type and then dereferences the pointer: Code: typedef unsigned uint32_t; Is the declaration of the pointer parameter ary a violation of this rule? Is the statement that dereferences ary a violation of this rule? Re: Rule 18.8 and clarification of "use" of VLA types - misra-c - 08-12-2017 Rule 18.8 applies to uses of VLA types. The intention of the MISRA-C working group is that "uses" include the places where the type is "used". e.g.
Code: void foo(uint32_t sz, |