
if( lineDirection.length2() ){...} 其中length2返回一个double.有点让我感到困惑的是0.0等于0,NulL和/或false.
这是C标准的一部分还是未定义的行为?
解决方法 这是一个非常标准的行为(布尔转换)总结$4.12/1 – “An rvalue of arithmetic,enumeration,pointer,or pointer to member type can be converted to an rvalue of type bool. A zero value,null pointer value,or null member pointer value is converted to false; any other value is converted to true.”
以上是内存溢出为你收集整理的if(double)有效C吗?全部内容,希望文章能够帮你解决if(double)有效C吗?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)