貌似是微软编译器的一个Bug
2013-09-06 11:46
295 查看
有如下代码:
在vc6.0和vs2010中运行,你能说出它的输出结果吗?
答案:ONE
以上代码在gcc中确是不同的结果。。。
或许是微软编译器的一个bug吧,求解释!
参考资料:
[1].http://stackoverflow.com/questions/18008126/floating-point-constant-comparison-0-0-1-0
[2].http://ideone.com/8qPRJd
#include <stdio.h> int my_func(void) { /* float f = 0.0; */ return(0.0 ? 1 : 0); } int main(void) { printf("%s\n", ( my_func() ? "ONE" : "NIL") ); return 0; }
在vc6.0和vs2010中运行,你能说出它的输出结果吗?
答案:ONE
以上代码在gcc中确是不同的结果。。。
或许是微软编译器的一个bug吧,求解释!
参考资料:
[1].http://stackoverflow.com/questions/18008126/floating-point-constant-comparison-0-0-1-0
[2].http://ideone.com/8qPRJd
相关文章推荐
- 能存活19年的bug不是bug——有感于微软宣布修复了一个存在了19年的安全漏洞
- gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-2ubuntu1~12.04) 编译器的一个BUG(不是bug)
- 这是vs2008编译器的一个bug么?
- (转) 如何使CheckBoxList的Attributes属性生效(修改微软的一个bug)
- VC7.1 编译器的一个不大不小的bug
- 发现微软VS工具的一个问题,不知算不算是BUG
- 微软Callback中的一个Bug
- asp.net 的一个新bug. 当你的程序出问题时, 不仅仅要检查自己的代码和逻辑, 还要检查微软的代码, 累吗?
- 微软vs2003 vc.net头文件的一个bug
- 碰到一个微软的bug:CWinAppEx::GetString
- VS编译器优化诱发一个的Bug
- VC7.1 编译器的一个不大不小的bug
- gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-2ubuntu1~12.04) 编译器的一个BUG(不是bug)
- VC7.1 编译器的一个不大不小的bug
- asp.net 中,微软tree控件的一个bug修改。
- 今天发现一个Convert.ToDateTime的异常,算不算微软的bug呢?
- 貌似是chrome在ubuntu下的一个bug
- 你会用微软sql server的Update语句的一个扩展功能,还有如何绕过它的一个bug(首发)吗?
- 如何使CheckBoxList的Attributes属性生效(修改微软的一个bug)
- 分享一个IPhone bug的分析过程(兼xcode编译器应该改进的地方)