I’m debugging some code and I need to break everytime, when character in string (const char *) is equal to something.
So I put there breakpoint and attach condition like: s[0] == 'e'. But code I’m debugging is in CRT and there is possibility, that s == 0 is true. So “addressing empty pointer” should give some kind of error. Yes – I could give there condition s != 0, but it would not be such fun 🙂
And I’m curious, what will debugger do when trying to evaluate this condition? How it will behave internally? Obviously it’s not giving any error nor stopping on this breakpoint when s == 0
Thanks for your answer.
Never tried it, but I think it will stop execution. My assumption is based on this:
If you set a breakpoint condition with invalid syntax, a warning message appears immediately. If you specify a breakpoint condition with valid syntax but invalid semantics, a warning message appears the first time the breakpoint is hit. In either case, the debugger breaks execution when the invalid breakpoint is hit. The breakpoint is skipped only if the condition is valid and evaluates to false.Source.