Darin, 09 Aug you wrote to me:
DM> char szBuf[128];
DM> sprintf(szBuf, "...", ...);
DM> WinMessageBox(HWND_DESKTOP, szBuf, "function name", MB_OK,
DM> ...)
EW> Wouldn't
EW> dbg("function name", ..., "...", ...);
EW> be easier? Perhaps even
DM> Heck, no. That would require writing a dbg function!
It wouldn't be much larger than the snippet you posted.
void dbg(const char function[], type1 arg1, const char format[], ...) {
va_list va;
char buf[128];
va_start(va, format);
vsprintf(buf, format, va);
WinMessageBox(HWND_DESKTOP, buf, function, MB_OK, arg1);
va_end(va);
}
Not something I would call a requirement. ;-)
DM> Sometimes I just need a quick peek, not a full-fledged
DM> debugging system.
With the above function it would require only one line, not three.
EW> dbg(number, "function name", ...);
EW> where number is a switch that can be put on from the command line. The
EW> debug code could again be useful later. ;-)
DM> Again, that's if I have time to develop a full-fledged
DM> debugging system into my code. I don't always have that
DM> luxury.
Just add
if (number != interesting_debug)
return;
to the function and add code to recognize the appropiate commandline switch.
Again, it won't take significant time.
Bye,
Erik
---
---------------
* Origin: WarmelinkE@vertis.nl (2:282/1.60)
|