RichardUSTC

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2013年3月21日

摘要: 在很多开源项目中,作者喜欢用宏定义以及预处理中的拼接技术来生成一些函数。比如,在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)... 阅读全文
posted @ 2013-03-21 17:30 RichardUSTC 阅读(1549) 评论(0) 推荐(0) 编辑