A debug assertion is code that is only present at debug. It tests an assumed
precondition and halts program execution immediately to bring attention to
the fact that the code is being executed while in a state never intended by
the author.
For example:
void Harvest(string vegetable)
{
ASSERT(vegetable != "cow")
// do work with vegetable
}
In this case it is possible to pass in a non vegetable, but the author is
assuming that no one would ever do this. In order to not waste time in a
release build checking every possible input the author beleives it is better
to ferret out impropper use of the routine at debug time. This way the
behavior will be immediately identified and corrected before the software
goes to release and clock cycles will not be wasted testing for a case that
will never happen.