index
goals: compile time
Bim: Spell-checkers have taught me that I'm not as good a speller as I thought I was.
Reader: Reality can hurt.
Compile-time is step one of ratification, a chance to check spelling, grammar, dead links: anything whose validation can be automated.Bim: Also, the check engine light keeps coming on, but I don't know why.
Reader: Find out.
The difference between compile and runtime errors is like catching a worn tire in your driveway, instead of suffering a blowout on the highway. It's the problem you want to have. They're not even properly mistakes.
A runtime error is a mistake:
Hotel rooms[20]; // a hotel with 20 rooms.
clean(rooms[21]); // <--compiles fine!
type-checking
Using dimensional analysis to make sure your apples aren't eating oranges.
miles_driven = mpg * gallons;
required functionality
Pure virtual functions or required template functions are tested at a compile. It's a way to enforce uniform processing, such as in group plugin pattern.
class Vehicle {
void FillTank() = 0; // Derived class must provide a way to do this.
};
modules
A decoupled system can be assembled (and tested) as independent executables, compiler-checked for compatibility.
nedwaves.com 2017 [171108]