[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    RE: kdebug
From:       David Faure <David.Faure () cramersystems ! com>
Date:       2000-02-09 10:40:09
[Download RAW message or body]

> Mirko Sucker wrote:
> > 
> > David Faure wrote:
> > > Note that it compiles fine without -pedantic.
> > Hm, good solution. Nana does not spit out any warnings when removing
> > ANSI and pedantic :-)
> > > Much like the previous bug I reported to them (what was 
> it ? can't remember...
> > > Ah yes some 'multiple inheritance and which method to call' bug),
> > > everything works fine when -pedantic isn't used.
> > I sometimes thought about some more C++ like way of 
> printing messages.
> > Is there a way to derive a ostream class to print output 
> that does not
> > do anything with NDEBUG, for example? Using inline 
> functions, this might
> > be no waste of ressources. And there is no "...", anymore.
> > Any ideas?
> 
> Sure, you can collapse the inline functions to nil in NDEBUG
> 
> Something like 
> dbgstream : public ostream {
> #ifdef NDEBUG
>   ostream &operator <<(int) { return *this; }
> #else
>   operator <<(int i) { cerr << i; return *this; }
> #endif
> }
> 

Sounds very good to me.
Though the script converting from kDebug* to this will be quite hairy :-)
(But well, I did a similar one for the other way round,
from cerr to kDebug !)

I agree that '<<' is much nicer to use than formats.

But ... how do you specify the debug area ?

or would this be only for debug area 0 ( = instance name printed, can't
be turned off individually by kdebugdialog ) ?

--
David Faure
faure@kde.org - KDE developer
david@mandrakesoft.com - Mandrake
david.faure@cramersystems.com - Cramer Systems

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic