Rule 22.1: object declaration and deleted timing - 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.22 Resources (https://forum.misra.org.uk/forumdisplay.php?fid=177) +---- Thread: Rule 22.1: object declaration and deleted timing (/showthread.php?tid=1540) |
Rule 22.1: object declaration and deleted timing - andy_su - 04-05-2020 Hi, I have a question about object declaration and deleted timing. I need to declare an object in constructor and release it in deconstructor, because the object will be reused frequently, but it is not compliant on MISRA C 2012. The sample code as below. Could you give me any hint to solve it? Thanks. Code: ABC::aa(const Arguments& args) Re: Rule 22.1: object declaration and deleted timing - misra-c - 01-06-2020 The above code is a violation of rule 1.1. Quote: The program shall contain no violation of the standard C syntax ....MISRA C:2012 is not applicable to C++ code. Such code should be analysed against the MISRA C++:2008 guidelines. |