readEntry and booleans

David Faure faure at kde.org
Thu Jan 5 12:24:03 GMT 2006


On Thursday 05 January 2006 13:14, Olivier Goffart wrote:
> Le Jeudi 5 Janvier 2006 10:42, David Faure a écrit :
> > On Wednesday 04 January 2006 21:34, Thomas Braxton wrote:
> > > forgot to attach the diffs :)
> > > in the second diff kconfigtest issues a warning about loss of information
> > > instead of crashing.
> >
> > In general I don't like to bring crashes onto users; but in this case I
> > fail to see how application code could use the right types most of the
> > times and incompatible types now and then; it would have to be pretty
> > generic code to end up doing that.... So IMHO the Q_ASSERT is fine, to
> > catch such an unlikely programming error early. Adding the warning in
> > addition can't hurt, for the release case :)
> 
> If the application is compiled without debug, Q_ASSERT is something like
> #define Q_ASSERT( COND )    do{}while(0)
> 
> So it's not for user, but for developper.

I know that; that's why I was suggesting to add a warning in addition, for the
user (i.e. so that we can see that this happened to a user when he/she sends
us a log file).

> Anyway, i'm used to use application i develop, and i don't like when it crash, 
> like all theses Q_ASSERT that occur now with QList

Well it certainly forces fixing the code ;-)

Actually with Qt-3.x I hacked some abort()s into my local Qt in order to
catch such things, so that we don't ship code that spits out lots of warnings
onto confused users. So it's good that Qt-4.x does this by default now.

> i'd maybe do a  
> 
> #define K_ASSERT( COND )   if(!COND){KMessageBox::error("ASSERT at line %1 of 
> file %2:  backtrace: %3");}

Message boxes are *really* annoying.

> Which has the benefit to force the user that use the program for debogging to 
> see there is a problem (kdWarning is often not seen because konsole beging 
> spammed with normal kdDebug)

Yes, but Q_ASSERTs are seen now :)

The point is that people who compile with debug are willing to debug - so a
crash is fine - and people who get release binaries are not willing to debug,
so for them it's better to just try to cope with the problem as much as we can
without bothering the user. A kdWarning helps in case the user reports some
problem to us though.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).





More information about the kde-core-devel mailing list