October 2004
Intermediate to advanced
240 pages
6h 22m
English
Start with a clean slate: Uninitialized variables are a common source of bugs in C and C++ programs. Avoid such bugs by being disciplined about cleaning memory before you use it; initialize variables upon definition.
In the low-level efficiency tradition of C and C++ alike, the compiler is often not required to initialize variables unless you do it explicitly (e.g., local variables, forgotten members omitted from constructor initializer lists). Do it explicitly.
There are few reasons to ever leave a variable uninitialized. None is serious enough to justify the hazard of undefined behavior.
If you’ve used a procedural language (e.g., Pascal, C, Fortran, or Cobol) you might be used to defining ...