R.13.5 When does a function have persistent side effects - 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.13 Side effects (https://forum.misra.org.uk/forumdisplay.php?fid=168) +---- Thread: R.13.5 When does a function have persistent side effects (/showthread.php?tid=1171) |
R.13.5 When does a function have persistent side effects - misra-c - 27-03-2015 Consider the following example: Code: bool fn ( int x ) Is this a violation of rule 13.5? Re: R.13.5 When does a function have persistent side effects - misra-c - 27-03-2015 A function is considered to have persistent side effects if there is a path through the function that might cause a persistent side effect. This determination takes no consideration of the possible values for parameters or other non-local objects. Therefore, "fn(-3)" is considered to have persistent side effects" even though in this case the value of "y" is known not to change. |