do { x } while (__LINE__ == -1)
来源:互联网 发布:nginx 添加第三方模块 编辑:程序博客网 时间:2024/04/29 02:55
#define st(x) do { x } while (__LINE__ == -1)
1, __LINE__ 是个宏,它代表当前代码在源文件的行号,它是大于0的,所以__LINE__ == -1 等同于0,化简为:
#define st(x) do { x } while (0)
2,do {} while (0)通常用于宏中, 为的是避免如下情况:
#define st(x) x
那么我们在调用 if (0) st(a = b; b = c;) 时会被解释成
if(0)
a = b;
b = c;
可见 if 只对a = b;起作用。
*************************************************
也就是将几句话打包以避免
***************************************************
1, __LINE__ 是个宏,它代表当前代码在源文件的行号,它是大于0的,所以__LINE__ == -1 等同于0,化简为:
#define st(x) do { x } while (0)
2,do {} while (0)通常用于宏中, 为的是避免如下情况:
#define st(x) x
那么我们在调用 if (0) st(a = b; b = c;) 时会被解释成
if(0)
a = b;
b = c;
可见 if 只对a = b;起作用。
*************************************************
也就是将几句话打包以避免
***************************************************
0 0
- do { x } while (__LINE__ == -1)
- #define st(x) do { x } while (__LINE__ == -1)
- 谈谈#define st(x) do { x } while (__LINE__ == -1) 的理解
- #define st(x) do { x } while (__LINE__ == -1)的意义(转)
- #define st(x) do { x } while (__LINE__ == -1)及“\”分析
- 谈谈#define st(x) do { x } while (__LINE__ == -1) 的理解
- 谈谈#define st(x) do { x } while (__LINE__ == -1) 的理解
- 【C】do{}while、do{}while(false)、do{}while(__LINE__==-1)使用分析
- Cocos2d-x do{ }while(0);
- while(付出!=成功)do{...}
- cocos2d-x C++的do...while(0)
- cocos2d-x系列笔记技巧篇(1)---关于do{}while(0)和CC_BREAK_IF的用法
- 问题四十五: f=1-i/2!+1/3!-...+1/9! (do while 循环)
- do-while
- do while
- do while
- do while
- do while
- 【转载】Servlet映射的匹配原则,优先级
- sed 递归替换
- 牛顿下山法
- python 刷题:实现队列
- POJ 3675 三角剖分
- do { x } while (__LINE__ == -1)
- viewPager 镶嵌fragment 报StackOverflowError
- IOS-57-导致内存未释放的常见原因(现象:dealloc不执行等)
- 对图片的压缩处理
- 【编程工具】MyEclipse中的常用快捷键
- wpf Listbox用collectionview分组展示效果
- 学习英语
- CF 596A. Wilbur and Swimming Pool 【计算矩形面积】
- .net4.0调用非托管DLL的异常捕获