MISRA Discussion Forums
8.7 if applied to C++ - 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: 2004 rules (https://forum.misra.org.uk/forumdisplay.php?fid=17)
+---- Forum: 6.8 Declarations and Definitions (https://forum.misra.org.uk/forumdisplay.php?fid=35)
+---- Thread: 8.7 if applied to C++ (/showthread.php?tid=716)



8.7 if applied to C++ - gs - 15-03-2010

Suppose one wanted to ensure one's C++ code complied with the MISRA C guidelines. Would a static data member of a struct or class be permitted to be accessed by only one function or should that static member be defined at block scope? Suppose the struct/class type were a local one? Would moving the definition of the static member out of the class and directly into block scope provide any benefit?


Re: 8.7 if applied to C++ - jbezem - 16-03-2010

Not at all sure what you would want to do. AFAIK C doesn't know aynthing like "static data members of a struct", nor a class for tha matter. And why would you want to use MISRA C on C++ code, there's MISRA C++ for that. I'd guess you can write C code to be processed by a C++ compiler, if that's what you need. Other than that, maybe you could give an example.

FWIW,

Johan


Re: 8.7 if applied to C++ - misra-c - 13-05-2010

We would recommend that C++ code comply with the MISRA C++ Guidelines.