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.

Us<strong>in</strong>g the Debugger<br />

The fastest way to edit a watch item is to double-click on its name <strong>in</strong><br />

the Watch List.<br />

Enabl<strong>in</strong>g and Disabl<strong>in</strong>g Watch Items<br />

As with breakpo<strong>in</strong>ts, <strong>in</strong>dividual items <strong>in</strong> the Watch List can be enabled or disabled. When<br />

a watch item is disabled, it is grayed and its value shows .<br />

To disable a watch item, click on the item’s name <strong>in</strong> the Watch List and choose Disable<br />

Watch from the Watch List speed menu. To enable the watch item aga<strong>in</strong>, choose Enable<br />

Watch from the speed menu.<br />

NOTE<br />

You may want to disable watch items that you don’t currently want to<br />

watch but that you will need aga<strong>in</strong> later. Hav<strong>in</strong>g a number of enabled<br />

items <strong>in</strong> the Watch List can slow down program execution dur<strong>in</strong>g the<br />

debugg<strong>in</strong>g process because all the variables <strong>in</strong> the Watch List must be<br />

updated each time a l<strong>in</strong>e of code executes. It doesn’t take many items <strong>in</strong><br />

the Watch List to slow th<strong>in</strong>gs down, so don’t forget to delete or disable<br />

any unused items <strong>in</strong> the Watch List.<br />

Add<strong>in</strong>g Variables to the Watch List<br />

You can add variables to the Watch List <strong>in</strong> one of several ways. The quickest is to click on<br />

the variable name <strong>in</strong> the editor w<strong>in</strong>dow and then select Add Watch at Cursor from the Code<br />

Editor speed menu or press Ctrl+F5. The Watch Properties dialog box will be displayed,<br />

where you can either select watch options for the watch item or click OK (or press Enter) to<br />

accept the defaults. The watch item will be added to the Watch List.<br />

To add a variable to the watch without first locat<strong>in</strong>g it <strong>in</strong> the source file, choose Run | Add<br />

Watch from the ma<strong>in</strong> menu. When the Watch Properties dialog box comes up, enter the<br />

name of the variable you want to add to the Watch List and click OK.<br />

NOTE<br />

TIP<br />

Although you can add a class <strong>in</strong>stance variable to the Watch List, the<br />

displayed value will not likely be useful. In the case of po<strong>in</strong>ters to<br />

objects, this is useful for determ<strong>in</strong><strong>in</strong>g if the po<strong>in</strong>ter is valid, but often<br />

405<br />

11

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

Saved successfully!

Ooh no, something went wrong!