MISRA Discussion Forums

Full Version: Clarification of 20.1 Scope
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Gavin McCall

Question:

Question 1: Interpretation of \"Reserved identifiers, macros and functions in the standard library\"

Does this phrase mean
a) \"Reserved identifiers
AND
macros in the standard library
AND
functions in the standard library\"
or
b) \"Reserved identifiers in the standard library
AND
macros in the standard library
AND
functions in the standard library\" ?

It seems that in case of a) above, \"#define __ABC (10)\" violates Rule 20.1 whereas it does not in case of b), because \"__ABC\", which is a reserved identifier, is not in the standard library. Moreover, it is not guaranteed that all of \"__LINE__, __FILE__, __DATE__, __TIME__, __STDC__ \"
are in the standard library. If not in the standard library, it is presumed that they can be \"defined, redefined or undefined\". Which interpretation should we take, a) or b) ?

MISRA C Steering Team Answer (7/9/2005)
Option A.
Reserved identifiers are defined by ISO/IEC 9899:1990 sections 7.1.3 Reserved Identifiers, 7.13 Future library directions and 6.8.8 Predefined Macro Names.
Macros in the standard library are examples of reserved identifiers.
Functions in the standard library are examples of reserved identifiers.

Any identifier in the standard library is an example of reserved identifiers
.