摘要:
在很多开源项目中,作者喜欢用宏定义以及预处理中的拼接技术来生成一些函数。比如,在QEMU的源码中就使用这种方式来定义函数// file1#define xglue(x, y) x ## y#define glue(x, y) xglue(x, y)// file2#define HELPER(name) glue(helper_, name)// file3uint32_t HELPER(clz)(uint32_t x){ return clz32(x);}其实最终的效果就是定义了uint32_t helper_clz(uint32_t x){ return clz32(x)... 阅读全文