[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Debuglevels, assertions



Again on those debuglevels ('cause I still think it's a good thing)
(this is a rethought copy of my previous post concerning that topic)

My suggestion:

PPDEBUGLEVEL == 0 : No debugging info, ppError () macros *are* evaluated
(i.e. they should be only used for *really* critical stuff)

PPDEBUGLEVEL >= 1 : Evaluation of ppInternalError () (new macro, used for
internal return value checking etc, i.e. stuff that can be ommitted in the
final, extensively debugged version)

PPDEBUGLEVEL >= 2 : Evaluation of ppWarning (). Debugging info warning the
debugger about oddities that shouldn't be (but are not critical)

PPDEBUGLEVEL >= 3 : Evaluation of ppAssert (). See below.

PPDEBUGLEVEL >= 4 : Evaluation of ppDebug1 (). Info about entering/leaving
major code sections (e.g. "configfile parsing started" / "configfile parsing
finished successfully")

PPDEBUGLEVEL >= 5 : Evaluation of ppDebug2 (). More detailed progress info
(e.g. "Processing configfile line x")

PPDEBUGLEVEL >= 6 : Evaluation of ppDebug3 (). medium detail info about the
processed data (e.g. "Line contains token 'DefaultResolution' with value
'800x600'")

PPDEBUGLEVEL >= 7 : Evaluation of ppDebug4 (). Info about variable values at
important points (e.g.  "(int) DefaultResX = 800  ;  (int) DefaultResY =
600")

PPDEBUGLEVEL >= 5 : Evaluation of ppDebug5 (). Really excessively detailed
information (e.g. "LoopVariable = 1376  ;  NoOfCopiedBytes = 327860 ;
LastByteVal = 0x3F")

Of course That doesn't mean that every piece of code has to give this much
debug info ;)  But if debug info is given it has to behave this way.

That means extending the current ppDebug/ppWarning/ppError macro stuff to
include the macros mentioned above, taking care about debuglevel checking.

Any cons/suggestions? Else I'll include that stuff.


Ok, now about that assertion stuff. We need some ppAssert macro similar to
the std C assert ().
I *think* it should throw an exception (ppEAssertionFailed) instead of
exit()ing. That makes it possible to recover from the error (useful in some
cases) and the exception bloat doesn't really matter as it exists only in
the debug version. Comments?


Apropos exceptions: The exception class has to be extended to include the
__LINE__ and __FILE__ infos. If we wrap the throwing in some ppThrow ()
macro then that's easy. Countervoices? No? Ok.

Cu
	Christian
--

Pentium says: E=mc^1.993822756