O'Reilly logo

SAMS Teach Yourself C++ in 10 Minutes SECOND EDITION by Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Why Storage from the Heap Makes Testing Critical

Every program should be tested every time it is changed. But as you saw in the last lesson, when you start using heap-allocated storage and pointers, the danger of a problem arising when the program runs (at runtime) is much greater. Just look at some of the errors you might encounter:

  • Uninitialized pointer

  • Pointer initialized to NULL

  • Deleting twice

  • Not deleting at all

  • Going past the bounds of an array

These problems may or may not have consequences anywhere near the place where the error occurred. They may, like the fourth error listed here, not have any apparent effect at all.

C++ compilers enforce good programming practices such as strong typing, but still allow many dangerous errors to occur. There ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required