4 ms·
If you use modules with opaque pointers, the types are incomplete and therefore their size is not known outside of the module. You can either make the type visi
by okl 8y ago
If you use modules with opaque pointers, the types are incomplete and therefore their size is not known outside of the module. You can either make the type visible (against the idea of opaque pointers), modify the module to allocate a fixed set of instances (somewhat against the open/closed principle), or you let the module use malloc to allocate memory for new instances.
- CyberDildonics 8y agoWhy would someone be doing this while trying to fit within the boundaries of the MISRA standard? Also what do you mean by module?
- okl 8y agoThe rule you are referring to is a "required" (not a "mandatory") rule. You can deviate from it and still be MISRA-C compliant. People write deviations for all kinds of reasons. Here are some rationales for deviations: https://lars-lab.jpl.nasa.gov/JPL_Coding_Standard_C.pdf https://lars-lab.jpl.nasa.gov/JPL_Coding_Standard_C.pdf (Rule 5 on page 10 on malloc) https://www.keil.com/pack/doc/CMSIS/Core/html/coreMISRA_Exceptions_pg.html https://www.keil.com/pack/doc/CMSIS/Core/html/coreMISRA_Exce... The unit of reuse that defines the type, example: http://c-faq.com/struct/sd1.html http://c-faq.com/struct/sd1.html
- CyberDildonics 8y agoSo your solution, in a thread about using a fixed amount of memory, is to do nothing different and let anything use the heap at any time because it might be possible in some cases to get it past MISRA standards? I'm not really sure of what you are trying to say, it seems you keep skewing further from the original discussion.