I'm going to a Meetup with Silicon Valley Chrome Developers! http://meetu.ps/2n8J
My 2C to community will be from this blog.
2010-11-16
2010-11-04
ASSERT - how it should be
ASSERT in case of failure should dump the file/line along with string
presentation of condition. Ideally some extra info similar to TRACE
output:
ASSERT( conditionToFail)( var1, var2,...);
In debug mode it should ask to "break, ignore, ignore forever". On break set programmatic breakpoint and call debugger, than call condition once more.
Depend of interactivity ability (console, UI, none) prompt could be shown or not.
Pseudocode:
while( !condition )
{
static boolean ignoreForever = false;
if( ignoreForever )
break;
log(FILE,LINE);
log( "condition=" #condition# " var1=" #var1 "var2=" #var2 );
int pr = prompt( "assertion condition " #condition# " failed. break, ignore, ignore forever"? );
if( pr == ignore )
break;
if( pr == IgnoreForever )
{
ignoreForever = true;
break;
}
debugger; // programmatic breakpoint
int repeatAgain = 0;
condition; // second call for troubleshooting in debugger
if( !repeatAgain ) // in debugger set to 1 and will cycle again
break;
}
ASSERT( conditionToFail)( var1, var2,...);
In debug mode it should ask to "break, ignore, ignore forever". On break set programmatic breakpoint and call debugger, than call condition once more.
Depend of interactivity ability (console, UI, none) prompt could be shown or not.
Pseudocode:
while( !condition )
{
static boolean ignoreForever = false;
if( ignoreForever )
break;
log(FILE,LINE);
log( "condition=" #condition# " var1=" #var1 "var2=" #var2 );
int pr = prompt( "assertion condition " #condition# " failed. break, ignore, ignore forever"? );
if( pr == ignore )
break;
if( pr == IgnoreForever )
{
ignoreForever = true;
break;
}
debugger; // programmatic breakpoint
int repeatAgain = 0;
condition; // second call for troubleshooting in debugger
if( !repeatAgain ) // in debugger set to 1 and will cycle again
break;
}
Subscribe to:
Posts (Atom)