I need to #define a macros as a function. For example:
#define REGISTER 0x80000000
...
writel(addr, nic->regs + REGISTER); // arguments are address and register
I defined it like that:
#define WRITEL(addr, nic->reg + reg) ((writel(addr, nic->regs + (reg))))
What's wrong here? Thanks
Macro arguments are a bit like normal function arguments. On the left side you just need a name that is used on the right
#define WRITEL(ADDR, REG) (writel(ADDR, nic->regs + (REG)))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.