Re: AbiWord on Linux/Alpha


Subject: Re: AbiWord on Linux/Alpha
From: Justin Bradford (justin@ukans.edu)
Date: Wed Feb 09 2000 - 14:44:14 CST


> FWIW, I'm have to disagree. Why is the code checking data in asserts
> that isn't used during the normal execution of the program? Debug-only code
> should help detect potential problems in the release version; having debug
> code which doesn't at all apply to the release version is wasted effort.

As with Shaw's example the widget information passed to some functions
isn't used at that point in the processing. Sometimes it is later (via the
event), but regardless, if it didn't come from a legitimate widget,
something's wrong. It's very useful to test now, and and an absolute pain
to go back and restructure dozens or more classes to remove them later for
release builds. It's just a push/pop once it gets down into the assembly,
anyway (ie. trivial).

Also, many of the unused function arguments which currently show up in
code I have written are because I haven't written the code which will use
them yet.

However, I can suggest one solution, which is what wxWindows does:

Make a UT_UNUSED (or something similar) define, which is something like

#if UT_DEBUG
#define UT_UNUSED(x) x
#else
#define UT_UNUSED(x)
#endif

Then, for arguments which just test for asserts, we do this

void foo::bar(widget * UT_UNUSED(window), event * event)
{
   UT_ASSERT(window && event);
   _processEvent(event);
}

I think the above is a worthwhile thing to do, but still pretty trivial.
If there is a consensus that the unused define thing is ok, perhaps a
newcomer looking for a simple project would be interested in fixing all
the code?

Justin
   



This archive was generated by hypermail 2b25 : Wed Feb 09 2000 - 14:44:36 CST