开发者

Why is my Breakpoint Condition not being met when my Breakpoint Condition is being met in Visual Studio?

I have a piece of code in front of me that iterates through a long list of urls and something is going wrong when those urls include a certain type of document. I don't want to see every iteration, so I've set up a conditional breakpoint.

The trouble is that I'm not a C++ programmer so I'm slightly having to fish around to work out how to do what I want and I may be doing something obviously wrong.

My current condition is thus:

(strstr( url, "xlsx") == 0x00000000)

This should mean every time the url ( which is a UNICODE_char* ) doesn't contain the literal "xlsx" strstr will return a null pointer which should match the condition, as I understand it. I actually want it the other way round in the long term, but as there are only a couple of "xlsx" urls and I want to check it is working I have it this way up for now.

Well, my condition is not being met or at least the breakpoint is not being triggered.

Assuming that I was doing something wrong I copied the same value as a watch expression and set an unconditional breakpoint on the line before. The result looks like this as I step past my coinditional breakpoint:

Name                                 | Value
================================================
(strstr( url, "xlsx") == 0x00000000) | true

So apparently my condition can be true as far as the watch window is concerned but not trigger the conditio开发者_如何转开发nal breakpoint.

In order to experiment further I tried flipping the condition over so it was

(strstr( url, "xlsx") != 0x00000000)

As far as the conditional breakpoint is concerned this is also false, which seems a bit funny as that would mean it neither equalled nor didn't equal the null pointer value.

Is this some unusual property of null values in C++? Is there something really obvious I'm missing or some quirk of the language that is causing me to totally miss the boat on this one?


If your url is a unicode string, have you tried using wcsstr?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜