Discussion:
Debugging switch/case
(too old to reply)
UO
2007-09-10 08:51:24 UTC
Permalink
Hi,

Is there a bug when debugging a switch/case?
If I debug a switch/case like below:

void __fastcall TForm1::Button1Click(TObject *Sender) //.
{
int x;
int y;

x = 1; //.

switch(x) //.
{
case 0:
y = 11; //.
break; //.
case 1:
y = 3; //.
break; //.
case 2:
y = 10; //.
break; //.
}

x = 3;
y = 4; //.

ShowMessage(IntToStr(x) + "," + IntToStr(y)); //.
} //.

only the lines marked with //. have a debug mark after the start of the
program.
The line "x = 3" is executed normally, but its debug line is not "x = 3", it
is the last break of the switch/case block.
If I comment out the last break, then the line "x = 3" has got a debug mark.
This is a bit confusing.

Should it be interpreted as a bug?
Thanks...
Chris Uzdavinis (TeamB)
2007-09-10 17:38:42 UTC
Permalink
Post by UO
The line "x = 3" is executed normally, but its debug line is not "x = 3", it
Should it be interpreted as a bug?
Yes. I seem to remember from a long time ago that the first statement
after a switch was not considered a breakpoint-able statement. It
ran just fine, but didn't allow breakpoints. Are you using an old BCB
version or is this still the case in their new version?
--
Chris (TeamB);
UO
2007-09-11 10:18:42 UTC
Permalink
Post by Chris Uzdavinis (TeamB)
Yes. I seem to remember from a long time ago that the first statement
after a switch was not considered a breakpoint-able statement. It
ran just fine, but didn't allow breakpoints. Are you using an old BCB
version or is this still the case in their new version?
I'm using BCB6 Proffesional.

Loading...