avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Check whether two macros are equal to each other


From: Karol Babioch
Subject: [avr-gcc-list] Check whether two macros are equal to each other
Date: Sun, 03 Jun 2012 14:36:52 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

Hi,

I'm currently trying to check whether two macros are equal to each other. The idea is to generate different code, when they are equal, which basically means that they are connected to the same port.

Basically it looks something like this:

#define LED1_DDR DDRD
#define LED2_DDR DDRD
#if LED1_DDR == LED2_DDR
  // Code
#endif

But when trying to compile this, I get the following error:

error: operator '*' has no left operand

Interestingly enough it works just fine, when the values of the macros are not some sort of macro itself, but a literal, e.g. "one". It then just compiles fine.

Could anyone explain this to me? Is there any way around this (still using macros)?

Best regards,
Karol Babioch



reply via email to

[Prev in Thread] Current Thread [Next in Thread]