11.07.2015 Views

tYSR20

tYSR20

tYSR20

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Chapter 29Ten Ways to Avoid Adding Bugs to Your ProgramIn This Chapter Enabling all warnings and error messages Insisting on clean compiles Using a clear and consistent coding style Limiting the visibility Adding comments to your code while you write it Single-stepping every path at least once Avoiding overloaded operators Heap handling Using exceptions to handle errors Avoiding multiple inheritanceIn this chapter, I look at several ways to minimize errors, as well as ways tomake debugging the errors that are introduced easier.Enabling All Warningsand Error MessagesThe syntax of C++ allows for a lot of error checking. When the compilerencounters a construct that it cannot decipher, it has no choice but to generatean error message. Although the compiler attempts to sync back up withthe next statement, it does not attempt to generate an executable program.

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

Saved successfully!

Ooh no, something went wrong!