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

List:       kde-core-devel
Subject:    Re: kdebug
From:       Stephan Kulow <coolo () kde ! org>
Date:       2000-02-09 10:32:20
[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
}

You rely on the compiler to collapse all the unneeded ostreams, but
I think you can :)

Greetings, Stephan

-- 
As long as Linux remains a religion of freeware fanatics,
Microsoft have nothing to worry about.  
                       By Michael Surkan, PC Week Online

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

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