Macros with not distinct parameters names: raise rule 5.4?

Moderators: misra-c, david ward

Post Reply
ggoulas
Posts: 5
Joined: Tue Jun 09, 2009 1:43 pm
Company: The MathWorks

Macros with not distinct parameters names: raise rule 5.4?

Post by ggoulas » Mon Jun 12, 2017 2:27 pm

Hi,

Should the following raise MISRA C:2012 rule 5.4 ?

#define MACRO(MACRO) MACRO

and more generally:
#define X123456789_123456789_123456789_AA(X123456789_123456789_123456789_AB) f(X123456789_123456789_123456789_AB)

I thought that not since there is no confusion when parameters are substituted because the macro is not active.
Is it right?
Many thanks!

misra-c
Posts: 571
Joined: Thu Jan 05, 2006 1:11 pm

Re: Macros with not distinct parameters names: raise rule 5.4?

Post by misra-c » Thu Sep 21, 2017 10:44 am

Your example is compliant with rule 5.4. This rule only requires that the macro being defined has a name that is distinct from
  • the names of other macros that are currently defined
  • the names of macro parameters in other macros that are currently defined.
---
Posted by and on behalf of
the MISRA C Working Group

Post Reply

Return to “8.5 Identifers”