Keil Logo

C51: WARNING 317 (REDEFINITION OF MACRO)


Information in this article applies to:

  • C51 Version 5.50a
  • C51 Version 6.03

QUESTION

I'm working on a project that includes nexted header files with multiple identical macro definitions. For example:

#define JJJ 123
#define JJJ 123

These macros are identical, but doesn't the compiler warn about these?

ANSWER

The C51 Compiler only warns you if the macro definitions are different. For example, the following program:

#define JJJ 123
#define JJJ 123
#define JJJ 345

void main (void)
{
}

compiles with the following diagnostics:

stmt level    source

   1          #define JJJ 123
   2          #define JJJ 123
   3          #define JJJ 345
*** WARNING 317 IN LINE 3 OF .\main.c: redefinition of macro 'JJJ'
   4
   5          void main (void)
   6          {
   7   1      }
   8
   9

As you can see, no warning is generated for line 2. But, a warning is generated for line 3 since the macro definition is different.

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Thursday, October 26, 2000


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.