C++ QT 4.8普通比较时的碰撞
请帮我解释一下意外事故!!! 我有: x、 h ……等等 x、 cppC++ QT 4.8普通比较时的碰撞,c++,qt,crash,C++,Qt,Crash,请帮我解释一下意外事故!!! 我有: x、 h ……等等 x、 cpp 如果((bitmap.S2L\u NOTIFY.mono.state==3))-
如果((bitmap.S2L\u NOTIFY.mono.state==3))
-<此处不崩溃
如果((bitmap.S2L\u NOTIFY.color.state==3))
-<此处不崩溃
请告诉我哪里错了或编译器错了?问题是您的条件中有x,但函数
x::rndfunc()
是类x的成员函数。。。不是一个变量。应该是:
// "this" refers to the current instance of class x
if((this->y.z.f.nmb2 == NOTOK) && (this->y.z.f.nmb1 == NOTOK))
或者简单地说:
// but the "this" isn't actually necessary
if((y.z.f.nmb2 == NOTOK) && (y.z.f.nmb1 == NOTOK))
(如你所写)
编辑:好的,原来的问题中有一个输入错误,因此上面的内容不再相关。新的答案是:
f
没有成员变量nmb1
,只有nmb2
编辑#2:更多打字错误。我的新答案是:
你想做的事情看起来很混乱。不要这样做。你能在
valgrind
或其他调试器下运行你的程序吗?你至少应该发布一个编译的代码。。您提供的是foobar。如果((this->y.z.f.nmb2==NOTOK)和(&(this->y.z.f.nmb1==NOTOK))是我的打字错误,程序仍然不起作用。@那么nmb1不是f的成员变量(而是h)这不是问题吗?这是调试模式错误!所以我试着在调试模式下调试我的其他bug,这个比较bug阻止了我。p、 美国调试模式错误?!洛威尔,很高兴你明白了!
// "this" refers to the current instance of class x
if((this->y.z.f.nmb2 == NOTOK) && (this->y.z.f.nmb1 == NOTOK))
// but the "this" isn't actually necessary
if((y.z.f.nmb2 == NOTOK) && (y.z.f.nmb1 == NOTOK))