Listing 7: Using assertions as a stopgap during development
class IC_Instructions
{
...
enum { kMaxICInstructions = 10240 };
// Pointer to next available instruction slot.
IC_Instruction* InstructionPtr;
int InstructionCount;
void AddInstr( IC_Instruction& Instr );
...
}
void IC_Instructions::AddInstr( IC_Instruction& Instr )
{
if( InstructionCount < kMaxICInstructions )
{
*InstructionPtr = Instr;
++InstructionPtr;
++InstructionCount
}
else
{
assert( IC instruction overflow" == NULL );
}
}
//End of File