MISRA Discussion Forums
declaration or definition - 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: 8.2 Unused code (https://forum.misra.org.uk/forumdisplay.php?fid=157)
+---- Thread: declaration or definition (/showthread.php?tid=1260)



declaration or definition - Motozo Mario Ikeda - 23-06-2016

Rule 2.3 mentions "type declaration".
Rule 2.5 mentions "macro declaration".

But I think the type should not be declared but defined by "typedef".
I also think the macro should not be decalred but defined by "#define".

MISRA Study Group in Japan is confused when translating the guidelines.

Thank you


Re: declaration or definition - misra-c - 27-06-2016

Rule 2.3 :
typedef names are referred in the C standard as declarations, apart from the section heading of 6.7.7 . See C99 section 6.7.7(3).
struct S { int a; int b; } is also a type declaration. See C99 section 6.7.2.1.

Rule 2.5 :
The working group acknowledges that "macro declarations" should have been referred to as "definitions".

( Note: this post has been moved from the MISRA-C:2004 section to MISRA-C:2012)