MISRA Discussion Forums
Rule 21.8, assert, and abort - 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: Rule 21.8, assert, and abort (/showthread.php?tid=1550)



Rule 21.8, assert, and abort - michael.metivier - 02-11-2020

Does the prohibition on calling the termination functions, specifically "abort", given by Rule 21.8 apply for any process that may arrive at abort? Or only to direct calls to abort requested by user-written code? This is of interest due to the definition of assert which indicates that it calls the "abort" function if the assert fails. Does 21.8, then, prohibit the use of assert?


RE: Rule 21.8, assert, and abort - misra-c - 21-08-2021

It is implicit that expansion of the assert() macro that includes a call to abort() is a violation to Rule 21.8.

The prohibition on calling the termination functions, including "abort", given by Rule 21.8 applies for any process that may arrive at such functions.