Dir 4.8 If no pointer is declared but implementation is visible

Moderators: misra-c, david ward

Post Reply
cxlin
Posts: 6
Joined: Tue May 12, 2015 1:24 am
Company: Red Lizard Software

Dir 4.8 If no pointer is declared but implementation is visible

Post by cxlin » Thu Mar 29, 2018 12:11 pm

For Dir 4.8 the document is not clear about whether the following case should be considered as non-compliant.

/* def.h */
struct SomeType
{
/* Object implementation */
}

/* no-use.c */
#include def.h
/* Do something. But no use of SomeType at all. */

The example doesn't involve any pointer but indeed goes against the rationale since the implementation details of SomeType is not needed in no-use.c and it should at least be opaque. Also, logically, "no pointer" implies "a pointer is never dereferenced", since there is no such pointer to begin with.

Please kindly help to advise. Thanks!

misra-c
Posts: 555
Joined: Thu Jan 05, 2006 1:11 pm

Re: Dir 4.8 If no pointer is declared but implementation is visible

Post by misra-c » Fri May 04, 2018 11:58 am

Directive 4.8 does not apply in this situation as there is no object in the translation unit with a type of pointer to "struct SomeType".
---
Posted by and on behalf of
the MISRA C Working Group

Post Reply

Return to “7.4 Code design”