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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

412 Day 11<br />

Other Debugg<strong>in</strong>g Tools<br />

<strong>C++</strong>Builder has some additional debugg<strong>in</strong>g tools to aid you <strong>in</strong> track<strong>in</strong>g down bugs. Some of<br />

these tools are, by nature, advanced debugg<strong>in</strong>g tools. Although the advanced debugg<strong>in</strong>g tools<br />

are not as commonly used as the other tools, they can be very powerful <strong>in</strong> the hands of an<br />

experienced programmer.<br />

Evaluate/Modify<br />

The Evaluate/Modify dialog box allows you to <strong>in</strong>spect the current value of a variable and to<br />

modify the value of a variable if you want. Us<strong>in</strong>g this dialog box, you can test for different<br />

outcomes by modify<strong>in</strong>g a particular variable. This allows you to play a what-if game with your<br />

program as it runs. Figure 11.8 shows the Evaluate/Modify dialog box <strong>in</strong>spect<strong>in</strong>g an <strong>in</strong>teger<br />

variable called x.<br />

Figure 11.8.<br />

The Evaluate/Modify<br />

dialog box.<br />

The Evaluate/Modify dialog box works similarly to the Watch List or the Debug Inspector.<br />

If you click on a variable <strong>in</strong> the source code and choose Evaluate/Modify from the Code<br />

Editor speed menu, the variable will be evaluated. If you want to enter a value that is not<br />

currently show<strong>in</strong>g <strong>in</strong> the source code, you can choose Run | Evaluate/Modify from the ma<strong>in</strong><br />

menu and then type a variable name to evaluate.<br />

The Evaluate field is used to enter the variable name or expression you want to evaluate.<br />

When you click the Evaluate button (or press Enter), the expression will be evaluated and the<br />

result displayed <strong>in</strong> the Result field.<br />

TIP<br />

The Evaluate/Modify dialog box can be used as a quickie calculator.<br />

You can enter hex or decimal numbers (or a comb<strong>in</strong>ation) <strong>in</strong> a mathematical<br />

formula and have the result evaluated. For <strong>in</strong>stance, if you<br />

type<br />

0x400 - 256

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

Saved successfully!

Ooh no, something went wrong!