为什么这个C ++ code编译?它有什么作用? [英] Why does this C++ code compile? What does it do?

查看:85
本文介绍了为什么这个C ++ code编译?它有什么作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个问题时,我不小心删除的方法名。在code从

I had this problem when I accidentally deleted the method name. The code went from

bool bRet = MethodName(pData, pOutFilename);

bool bRet = (pData, pOutFilename);

但仍编译?这是什么code呢?这是什么意思?它似乎返回true,这是总是如此(即使pdata将空)?

but still compiled? What does this code do? What does it mean? It seems to return true, is this always the case (even if pData is null)?

任何想法,欢迎!

推荐答案

这是逗号操作符其中

评估其第一操作数和丢弃结果,然后
  计算第二个操作数,并返回该值(和类型)。

evaluates its first operand and discards the result, and then evaluates the second operand and returns this value (and type).

这篇关于为什么这个C ++ code编译?它有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆