14-03-2014, 06:53 PM
20.1 (req): %s: Reserved identifiers, macros and functions in the standard library, shall not be defined, redefined or undefined.
20.2 (req): %s: The names of standard library macros, objects and functions shall not be reused.
As per the rule 20.1, Reserved identifiers should not be defined, redefined or undefined.
I am getting the violation of MISRA 20.2 for the below example:
For the declaration,
int for;
'for' is the reserve identifier. It is re-defined as variable declaration and it is not used in any standard library.
Hence it should violates the MISRA rule 20.1 and not MISRA rule 20.2.
Please explain the difference between MISRA 20.1 and 20.2 rules with suitable examples.
20.2 (req): %s: The names of standard library macros, objects and functions shall not be reused.
As per the rule 20.1, Reserved identifiers should not be defined, redefined or undefined.
I am getting the violation of MISRA 20.2 for the below example:
For the declaration,
int for;
'for' is the reserve identifier. It is re-defined as variable declaration and it is not used in any standard library.
Hence it should violates the MISRA rule 20.1 and not MISRA rule 20.2.
Please explain the difference between MISRA 20.1 and 20.2 rules with suitable examples.
<t></t>