8.7 if applied to C++

6.8 Declarations and Definitions

Moderators: misra-c, david ward

Post Reply
Posts: 87
Joined: Thu Nov 18, 2004 1:39 am

8.7 if applied to C++

Post by gs » Mon Mar 15, 2010 6:25 pm

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?

Posts: 20
Joined: Mon Aug 01, 2005 8:24 pm
Company: JB Enterprises
Location: Germany

Re: 8.7 if applied to C++

Post by jbezem » Tue Mar 16, 2010 5:54 am

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.


Johan Bezem
Email: [email protected]
Tel: +49 172 5463210
Web: http://www.bezem.de/

Posts: 572
Joined: Thu Jan 05, 2006 1:11 pm

Re: 8.7 if applied to C++

Post by misra-c » Thu May 13, 2010 10:34 am

We would recommend that C++ code comply with the MISRA C++ Guidelines.
Posted by and on behalf of
the MISRA C Working Group

Post Reply

Return to “6.8 Declarations and Definitions”