Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A20-8-2 / A20-8-3 - Is returning a non-owning pointer always a violation?
#4
(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 Big Grin .

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.
Reply


Messages In This Thread
RE: A20-8-2 / A20-8-3 - Is returning a non-owning pointer always a violation? - by kent.dorfman766 - 15-12-2022, 03:17 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)