MISRA Discussion Forums

Full Version: Dir 4.14 - How to check pointer to structure
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
For example:
Code:
typedef struct myStruct{
    int myParam;
} myStruct;

void fcn(myStruct *const ptr)
{
    ptr->myParam = 1;
}

What is the recommended way to check the struct pointer in this function?
There is no such Directive in MISRA C 2012 (Directive 4.13 is the highest number)?
Oh, I see.
But i don't think a local pointer classifies as external resource like specified in this particular directive.
If data of type myStruct is received over a communication channel you obviously need some sort of checksum.
Right.
I think that the problem was that these functions were not being used in the application, so the MISRA check was triggering this.
Now that I really use them in the application, I have no more errors.

Thanks for the feedback!
The amplification of Directive 4.14 gives a list of the sort of "external sources" that are covered by this directive.