[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Wed Mar 16 03:20:48 CET 2005


On Tuesday 15 March 2005 20:58, Barth Netterfield wrote:
> On Tuesday 15 March 2005 19:39, George Staikos wrote:
> > On Tuesday 15 March 2005 19:24, Barth Netterfield wrote:
> > > But I don't feel strongly enough to suggest that anyone do anything
> > > about it....
> >
> >   I'd still like to know how to see this.  That's why the assert() is
> > there.
>
> The point itself is more or less irrelevant, as no-one knows how to trigger
> it, but the general principle may be interesting:  How should the code
> handle 'can't imagine how it could happen, and can't see how it would be
> useful' cases like this
> i) debugging code + death to see why it happened.
> 	rational: mystries are bad.  if it happens, its probably a bug
> ii) defensive code keep it from dieing here.
> 	rational: death is bad, and maybe the code can survive the 'odd event'.
>
> I've done both from time to time.  In this case, I like ii....

  assert() only triggers in code compiled with debug enabled so it shouldn't 
be any problem for production use.  We can put if() on every line in Kst and 
still not avoid crashes.  The view object code was very well defined in 
behavior when I wrote it, and if things are misbehaving, I can definitely fix 
it with a crash report.  Anyway, the if() remains but I still want to know if 
it ever triggers and the only way is with assert().  Runtime checks are a 
never-ending management problem so better to avoid the need for them from the 
start.

-- 
George Staikos
KDE Developer				http://www.kde.org/
Staikos Computing Services Inc.		http://www.staikos.net/


More information about the Kst mailing list