/// moved here for this example. PIND0 is a platform-specific number defined elsewhere
#define DIO0_PIN PIND0
#define MASK(PIN) (1 << PIN)
/// check if pin is an input
#define _GET_INPUT(IO) ((DIO ## IO ## _DDR & MASK(DIO ## IO ## _PIN)) == 0)
/// check if pin is an input wrapper
#define GET_INPUT(IO) _GET_INPUT(IO)
好吧,这里'一个5层的真实情况,甚至没有出现头文件:GET_INPUT(0),_ GET_INPUT(0),MASK, DIO0_PIN, PIND0
令牌粘贴(##)既神奇又令人困惑。这是一个非常简单的案例。如果你不这样做'不明白为什么需要最后的包装,抬头"Stringification".
(这些是从某些Repetier打印机固件中的fastio.h中清除的。)