MISRA Discussion Forums
Dir 4.8 If no pointer is declared but implementation is visible - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4)
+--- Forum: MISRA C:2012 and MISRA C:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=21)
+---- Forum: 7.4 Code design (https://forum.misra.org.uk/forumdisplay.php?fid=181)
+---- Thread: Dir 4.8 If no pointer is declared but implementation is visible (/showthread.php?tid=1410)



Dir 4.8 If no pointer is declared but implementation is visible - cxlin - 29-03-2018

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!


Re: Dir 4.8 If no pointer is declared but implementation is visible - misra-c - 04-05-2018

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".