本文介绍了这些 (bCondition == NULL) 和 (NULL==bCondition) 之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!
问题描述
在浏览 msdn 站点时,他们使用的大多数条件检查位置 (NULL == bCondition).
While exploring msdn sites ,most of the condition checking places they are using (NULL == bCondition).
使用这些符号的目的是什么?
what is the purpose of using these notations?
请提供一些示例来解释这些.
Provide some sample to explain these please.
谢谢.
推荐答案
当赋值运算符 = 被意外使用而不是比较运算符 ==:
The use of NULL == condition provides more useful behaviour in the case of a typo, when an assignment operator = is accidentally used rather then the comparison operator ==:
if (bCondition = NULL) // typo here
{
// code never executes
}
if (NULL = bCondition) // error -> compiler complains
{
// ...
}
C-compiler 在前一种情况下会给出警告,很多语言都没有这样的警告.
C-compiler gives a warning in the former case, there are no such warnings in many languages.
这篇关于这些 (bCondition == NULL) 和 (NULL==bCondition) 之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
The End


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)