15-12-2022, 03:17 AM
(13-12-2022, 05:04 PM)vanhuynh Wrote: To add some context, my difficulty is mostly because:
- Eventually I need to interface with C (POSIX) functions, which need raw pointers.
- Dynamic memory allocation on heap is not allowed.
I can't think of a solution satisfying these conditions using unique_ptr/shared_ptr. Feel free to suggest a solution if you have one .
I spent the past three years doing similar for a commercial space program. Unless you have the organizational power to disable specific warnings expect that most of your use of the POSIX system API will generate violations. POSIX system API is not compatible with MISRA/AUTOSAR.
Also 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.