Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 8.9 and macros
#5
Hi,

Suppose we have 2 c source code files (cfile1.c and cfile2.c) and 2 header files (hfile1.h and hfile2.h).
In hfile1.h I can #define BILL to be something and then #include hfile1.h in cfile1.c.
Now in hfile2.h I can #define BILL to be something else and #include hfile2.c in cfile2.c.
All this will compile and link without warnings.

The fact is I have 2 macros with the same name but with different definitions.
This is unwise and I can't see a MISRA rule that would forbid such code.
Am I mistaken?

Cheers,
BILL.


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)