[Top][All Lists]

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

[avr-gcc-list] nested macros don't expand

From: George Kvirkvia
Subject: [avr-gcc-list] nested macros don't expand
Date: Fri, 19 Nov 2010 23:48:46 +0400

I've ran into the problem when I tried to write simple port manipulation macros for avr


#define set_port_pin(port, pin) (port |= (1<<pin))

when I try to use this macro like this: set_port_pin(MOTOR_CONTROL_PIN);
I get preprocessor error, saying that set_port_macro expects 2 arguments and I pass only 1

When I rewrite the program and instead of defining macro set_port_pin I write a function
which does the same, the program compiles without error.

So the only reason for this I think is that preprocessor doesnt expand MOTOR_CONTROL_PIN macro
when it's used as parameter to another macro.

Any ideas?

Giorgi Kvirkvia

reply via email to

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