[previous] MISRA-C:2004  Rule  18.1:  (Required) [next] All structure and union types shall be complete at the end of a translation unit.
A complete declaration of the structure or union shall be included within any translation unit that reads from or writes to that structure. A pointer to an incomplete type is itself complete and is permitted, and therefore the use of opaque pointers is permitted. See section 6.1.2.5 of ISO/IEC 9899:1990 [2] for a full description of incomplete types.

struct tnode * pt;        /* tnode is incomplete at this point */

struct tnode
{
   int count;
   struct tnode *left;
   struct tnode * right;
};                        /* type tnode is now complete */


QAC messages that encompass this guideline:

0544 [U] The value of an incomplete 'union' may not be used.
0545 [U] The value of an incomplete 'struct' may not be used.
0623 [U] '%s' has incomplete type and no linkage - this is undefined.
0636 [U] There are no named members in this 'struct' or 'union'.


Related rules:

Rule  1.2 No reliance shall be placed on undefined or unspecified behaviour.



(c) The Motor Industry Research Association, 2004
QA C Source Code Analyser 8.1.2
MISRA-C:2004 Compliance Module 3.2
© 2013 Programming Research
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index Contents