Hello @Sidelobe,
If I understand correctly, you cannot put it because it is a C struct, not a C++ struct.
But the rule 7-3-1 allows C declarations in the global namespace. You should just write:
extern "C"
struct MyCStruct; // forward declaration
namespace MyNamespace {
class MyClass {
MyCStruct* m_myCStructInstance;
};
}
But notice it would still be a violation of 3-2-3 (I don’t think it makes much sense, and it will most probably be amended in the next MISRA release), so you should actually write:
// In <MyCStructFwd.h>
struct MyCStruct; // forward declaration
// In your code
extern "C" {
#include <MyCStructFwd.h>
}
namespace MyNamespace {
class MyClass {
MyCStruct* m_myCStructInstance;
};
}
Hope this helps!