avatar
C++ 无效语句?# Programming - 葵花宝典
d*e
1
看到有人的程序里有如下语句:
if(dbPtr || counter || shouldPrintRowCounts) ;
这样的语句有什么用意?
谢谢先
avatar
t*t
2
不知道dbPtr, counter, shoudPrintRowCounts是什么类型,不好判断

【在 d******e 的大作中提到】
: 看到有人的程序里有如下语句:
: if(dbPtr || counter || shouldPrintRowCounts) ;
: 这样的语句有什么用意?
: 谢谢先

avatar
h*e
3
most likely means:
if (NULL != dbPtr or 0 != counter or true == shouldPrintRowCounts)
do nothing

【在 d******e 的大作中提到】
: 看到有人的程序里有如下语句:
: if(dbPtr || counter || shouldPrintRowCounts) ;
: 这样的语句有什么用意?
: 谢谢先

avatar
c*l
4
hehe:)good interpretation

【在 h****e 的大作中提到】
: most likely means:
: if (NULL != dbPtr or 0 != counter or true == shouldPrintRowCounts)
: do nothing

avatar
t*t
5
since it's c++, it may involve some user-defined type conversion. so it's
difficult to say...

【在 h****e 的大作中提到】
: most likely means:
: if (NULL != dbPtr or 0 != counter or true == shouldPrintRowCounts)
: do nothing

avatar
d*e
6
dbPtr is a pointer, counter is an integer, the other one is bool.
sure, the syntax is simple and makes sense, The problem is I don't
understand what effect this statement has. It does not seem to have any
effect since the evalued result is not used in any way.
avatar
t*t
7

if so, then the statement doesn't make much sense.

【在 d******e 的大作中提到】
: dbPtr is a pointer, counter is an integer, the other one is bool.
: sure, the syntax is simple and makes sense, The problem is I don't
: understand what effect this statement has. It does not seem to have any
: effect since the evalued result is not used in any way.

avatar
d*e
8
that's what I am thinking, but I need to make sure. Thanks for the answer.

【在 d******e 的大作中提到】
: dbPtr is a pointer, counter is an integer, the other one is bool.
: sure, the syntax is simple and makes sense, The problem is I don't
: understand what effect this statement has. It does not seem to have any
: effect since the evalued result is not used in any way.

avatar
d*z
9
也许这里
shouldPrintRowCounts是一个复杂的宏?
不过如果这样,显然这个宏定义的不是很好,应该定义成看起来像一个函数更好一些

【在 d******e 的大作中提到】
: 看到有人的程序里有如下语句:
: if(dbPtr || counter || shouldPrintRowCounts) ;
: 这样的语句有什么用意?
: 谢谢先

avatar
a*l
10
it's more like a reminder for future expansion rather than something useful.

【在 d******e 的大作中提到】
: 看到有人的程序里有如下语句:
: if(dbPtr || counter || shouldPrintRowCounts) ;
: 这样的语句有什么用意?
: 谢谢先

avatar
g*z
11
也有可能是要实现 shouldPrintRowCounts 这个宏只在指针为空或记数为0时才执行
avatar
T*r
12
新手用来debug的,忘记删了. 哈哈..

【在 d******e 的大作中提到】
: 看到有人的程序里有如下语句:
: if(dbPtr || counter || shouldPrintRowCounts) ;
: 这样的语句有什么用意?
: 谢谢先

avatar
p*g
13
first check if any is macro. if not, set a break point here and step into to
see whether anything is called :)
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。