MISRA Discussion Forums
20.1, 20.2 scopes - 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: 2004 rules (https://forum.misra.org.uk/forumdisplay.php?fid=17)
+---- Forum: 6.20 Standard Libraries (https://forum.misra.org.uk/forumdisplay.php?fid=42)
+---- Thread: 20.1, 20.2 scopes (/showthread.php?tid=517)



20.1, 20.2 scopes - pkruk - 15-05-2008

Is rule 20.1 limited to #define and #undef directives?
Is rule 20.2 limited only to identifiers already defined in standard library?

If this is true:
Code:
void errno();
/* errono is a reserved keyword and is already defined in standard library */
/* This code is a violation of rule 20.2 only  */

int __MyVariable();
/* __MyVariable is also a reserved keyword but is not defined in standard library */
/* This code is not a violation of 20.1 nor 20.2 */



Re: 20.1, 20.2 scopes - misra-c - 20-05-2008

Quote:Is rule 20.1 limited to #define and #undef directives?

This is limited to #define and #undef.

Quote:Is rule 20.2 limited only to identifiers already defined in standard library?

The intent is that Rule 20.2 applies to both current library identifiers and all reserved identifiers. This includes all identifiers which begin with the underscore character. This will be clarified in the next version of MISRA-C.