kDebug improvements

Stephan Kulow coolo at kde.org
Wed Jan 17 09:43:15 GMT 2007

Am Mittwoch, 17. Januar 2007 10:35 schrieb Cyrille Berger:
> > And removing the extra << endl could be done in one go throughout the
> > code. Actually here is the only issue, about how to deal with:
> > kDebug() << "somestring";
> > somecode
> > kDebug() << "anotherstring" << endl;
> > if such case exists at all. IIRC kDebug already warns you about missing
> > endl.
> >
> > I'm all for it, as it would really make things easier, especially this
> > endl stuff.
> Actually I am more for removing the endl warning (and crash, yes yes it
> often crashes if you don't have the endl). It's very annoying if you want
> to display the content of an array on the debug output.

You can have a local kdbgstream object. The endl warning is mainly for older 
compilers and it seems Qt does not support them any longer, so this is indeed 
no longer an issue.

I must admit I like to use qDebug way more than kDebug these days too, but
the area is a really good addition for KDE (libraries). So I think we should 
try to overload qDebug(int) and leave kDebug() as it is. 

Please investigate how much code you would have to duplicate, but API-wise 
this sounds the best solution to me.

Greetings, Stephan

More information about the kde-core-devel mailing list