12.12.2012 Views

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

398 Day 11<br />

As you step through the program, the execution po<strong>in</strong>t is highlighted <strong>in</strong> blue and the editor<br />

w<strong>in</strong>dow gutter displays a black arrow glyph. Understand that the l<strong>in</strong>e highlighted <strong>in</strong> blue has<br />

not yet been executed but will be executed when program execution resumes.<br />

Once you have stopped at a breakpo<strong>in</strong>t, you can view variables, view the call stack, browse<br />

symbols, or step through your code. After you have <strong>in</strong>spected any variables and objects, you<br />

can resume normal program execution by click<strong>in</strong>g the Run button. Your application will<br />

aga<strong>in</strong> run normally until the next breakpo<strong>in</strong>t is encountered.<br />

NOTE<br />

It’s common to detect cod<strong>in</strong>g errors <strong>in</strong> your program after you have<br />

stopped at a breakpo<strong>in</strong>t. If you change your source code <strong>in</strong> the middle<br />

of a debugg<strong>in</strong>g session and then choose Run to resume program<br />

execution, the IDE will prompt you with a message box ask<strong>in</strong>g whether<br />

you want to rebuild the source code. If you choose Yes, the current<br />

process will be term<strong>in</strong>ated, the source code will be recompiled, and the<br />

program will be restarted.<br />

The problem with this approach is that your program does not get a<br />

chance to close normally, and any resources currently <strong>in</strong> use might not<br />

be freed properly, which could result <strong>in</strong> memory leaks. While W<strong>in</strong>dows<br />

95 and W<strong>in</strong>dows NT handle resource leaks better than 16-bit W<strong>in</strong>dows,<br />

it is still advisable to term<strong>in</strong>ate the program normally and then<br />

recompile.<br />

The Breakpo<strong>in</strong>t List W<strong>in</strong>dow<br />

The <strong>C++</strong>Builder IDE keeps track of the breakpo<strong>in</strong>ts you have set <strong>in</strong> the Breakpo<strong>in</strong>t list<br />

w<strong>in</strong>dow. To view the breakpo<strong>in</strong>t list, choose View | Breakpo<strong>in</strong>ts from the ma<strong>in</strong> menu. The<br />

Breakpo<strong>in</strong>t list w<strong>in</strong>dow will be displayed, as shown <strong>in</strong> Figure 11.2.<br />

Figure 11.2.<br />

The Breakpo<strong>in</strong>t list<br />

w<strong>in</strong>dow.<br />

The Breakpo<strong>in</strong>t list w<strong>in</strong>dow has four columns. The first column, Filename, shows the<br />

filename of the source code unit <strong>in</strong> which the breakpo<strong>in</strong>t is set. The second column, labeled<br />

L<strong>in</strong>e, shows the l<strong>in</strong>e number on which the breakpo<strong>in</strong>t is set. The Condition column shows

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!