Listing 1: Checking function parameters, index ranges, and order of function invocation
void AddCode( void *CodeLoc, unsigned CodeSize ) { assert( CodeLoc != NULL ); ... int CodeOffset = Add( CodeLoc, CodeSize ); ... } void MarkSelector( char* SelectorName ) { unsigned SelectorIndex = LookupSelector( SelectorName ); assert( SelectorIndex < NumSelectors ); SelectorArray[ SelectorIndex ].Mark = 1; } class CodeSection { bool ContentComputed; long ContentSize; ... CodeSection( void ) { ContentComputed = false; }; void SetContentSize( long Size ) { ContentSize = Size; ContentComputed = true; } long GetContentSize( void ) { assert( ContentComputed ); return ContentSize; } } //End of File