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.

368 Day 10<br />

NOTE<br />

The results of chang<strong>in</strong>g optimization sett<strong>in</strong>gs can vary widely. Each<br />

application is different. Sometimes optimiz<strong>in</strong>g for size has a big impact<br />

on the f<strong>in</strong>al executable file size; other times the difference is negligible.<br />

The same is true of optimiz<strong>in</strong>g for speed.<br />

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

The Debugg<strong>in</strong>g section of the <strong>C++</strong> page of the Project Options dialog box controls how the<br />

compiler generates code for debugg<strong>in</strong>g sessions. This section has four options, which are<br />

expla<strong>in</strong>ed <strong>in</strong> the follow<strong>in</strong>g sections. (I’ll discuss debugg<strong>in</strong>g operations <strong>in</strong> detail tomorrow.)<br />

Debug Information<br />

When the Debug <strong>in</strong>formation option is enabled, <strong>C++</strong>Builder will generate debug <strong>in</strong>formation<br />

for the project. The debug <strong>in</strong>formation is stored <strong>in</strong> a separate file <strong>in</strong> the project’s<br />

directory. The filename of the file conta<strong>in</strong><strong>in</strong>g the debug <strong>in</strong>formation has a .TDS extension.<br />

For example, if you had a program with a project name MyApp, <strong>C++</strong>Builder would generate<br />

a symbol file called MyApp.tds. This file is read by the debugger dur<strong>in</strong>g debug sessions. If you<br />

do not generate debug <strong>in</strong>formation, you will not be able to stop on breakpo<strong>in</strong>ts and <strong>in</strong>spect<br />

variables dur<strong>in</strong>g debugg<strong>in</strong>g. Put another way, you can’t debug your program unless you tell<br />

<strong>C++</strong>Builder to generate debug <strong>in</strong>formation.<br />

L<strong>in</strong>e Number Information<br />

The L<strong>in</strong>e number <strong>in</strong>formation option tells <strong>C++</strong>Builder to generate l<strong>in</strong>e number <strong>in</strong>formation<br />

for the project. L<strong>in</strong>e number <strong>in</strong>formation is used by the debugger to allow you to step through<br />

your code l<strong>in</strong>e by l<strong>in</strong>e. This option is automatically enabled when you have the Debug<br />

Information option turned on (even though the check box doesn’t show it). You can,<br />

however, turn debug <strong>in</strong>formation off and then turn l<strong>in</strong>e number <strong>in</strong>formation on. This will<br />

allow you to set breakpo<strong>in</strong>ts and step through your code, but you won’t be able to <strong>in</strong>spect<br />

any variables. The benefit is that your .tds file will be smaller. In reality, it is unlikely that<br />

you will opt to turn debug <strong>in</strong>formation off and l<strong>in</strong>e number<strong>in</strong>g on.<br />

Automatic Register Variables<br />

When the Automatic Register Variables option is on, the compiler will make use of register<br />

variables as it sees fit. The use of register variables allows for much faster code. Register<br />

variables can, however, be a bit of a pa<strong>in</strong> while debugg<strong>in</strong>g. The compiler might optimize<br />

your variables dur<strong>in</strong>g debugg<strong>in</strong>g, mak<strong>in</strong>g the variable unavailable for <strong>in</strong>spection. When a<br />

variable has been optimized, the watch w<strong>in</strong>dow will display the message Variable ‘x’ has<br />

been optimized and is not available when you attempt to <strong>in</strong>spect the variable.

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

Saved successfully!

Ooh no, something went wrong!