27-10-2023, 03:45 PM
This code should not be reported as a violation of A20-8-2/A20-8-3, as these are about the explicit use of unique_ptr/shared_ptr, and not requiring their use in situations such as in the above example.
However, the code does violate A9-3-1 Member functions shall not return non-const “raw” pointers or references to private or protected data owned by the class.
We agree with the poster that replied “…concentrate on inline C++ wrappers around the POSIX stuff so that you minimize the number of places where you have to justify the violations. A lot will be gained with proper layered system design.”
However, the code does violate A9-3-1 Member functions shall not return non-const “raw” pointers or references to private or protected data owned by the class.
We agree with the poster that replied “…concentrate on inline C++ wrappers around the POSIX stuff so that you minimize the number of places where you have to justify the violations. A lot will be gained with proper layered system design.”
Posted by and on behalf of
the MISRA C++ Working Group
the MISRA C++ Working Group