Definition of "used" for Rule 21.3 - 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.21 Standard libraries (https://forum.misra.org.uk/forumdisplay.php?fid=176) +---- Thread: Definition of "used" for Rule 21.3 (/showthread.php?tid=977) |
Definition of "used" for Rule 21.3 - rgamble - 03-09-2013 The rule states, in part, "The identifiers calloc, malloc, realloc and free shall not be used" but does not define what constitutes a use. Is the following example (intended to be) a violation of Rule 21.3? Code: void *(*mymalloc)(size_t) = malloc; Re: Definition of "used" for Rule 21.3 - Steve Montgomery - 04-09-2013 I think that "used" here is intended to be "shall not appear in an expression" which would mean that your example violates Rule 21.3. Re: Definition of "used" for Rule 21.3 - misra-c - 12-09-2013 With reference to the Glossary definition of used, such an attempt to obfuscate the calling of a prohibited function is still a usage. Therefore, in the example cited, the function malloc() is being used. |