MISRA Discussion Forums
Example at 11.1 and 11.2 - 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.11 Pointer type conversions (https://forum.misra.org.uk/forumdisplay.php?fid=166)
+---- Thread: Example at 11.1 and 11.2 (/showthread.php?tid=1177)



Example at 11.1 and 11.2 - ogawa.kiyoshi - 29-04-2015

In example codes in Rule 11.1 and Rule 11.2

#include /* to obtain macro NULL */

in example codes in 11.9

#include

A freestanding environment needs stdarg.h not sodlib.h.
So I prefer to obtain macro NULL,
#include // to obtain macro NULL

Is it reasonable?

ps. in 11.9
/* Could also be stdio.h, stdlib.h and others */

I prefer
/* A free standing environment needs stddef.h */
/* Could also be stdio.h, stdlib.h and others in host environments */

Best Regards.


Re: Example at 11.1 and 11.2 - misra-c - 11-05-2015

Thank you for your point. We will modify the examples to use stddef.h in a future update.

Note: A more correct statement in the original question would be "A freestanding environment needs stddef.h not stdlib.h.", since stdarg.h does not contain a definition of NULL.