07-04-2017, 05:50 AM
Hi MISRA,
I have a question about the following example from rule 9-3-1:
Here `getB` actually returns a pointer to the object that `b` referenced, not the member `b` itself. And that object doesn't seem to satisfy the definition of "class data" by 1) it's not non-staitc member data, and 2) it's not a resource acquired in the constructor or released in the destructor. So I'm not sure why this is a Non-compliant case. Could you help to clarify a bit? Thanks!
I have a question about the following example from rule 9-3-1:
Code:
class C {
public:
C ( int &b_ ) : b( b_ ) { }
int *getB () const
{
return &b; // Non-compliant
}
private:
int &b;
}
<t></t>