[Development] Let's get rid of qDebug/qWarning/qCritical!
Poenitz Andre
Andre.Poenitz at digia.com
Thu Jan 9 17:40:04 CET 2014
Koehne Kai wrote:
> On quinta-feira, 9 de janeiro de 2014 07:28:07, Koehne Kai wrote:
> > if qCWarning() would expand to an if (myCategory().isEnabled()) ...
>
> That's why it would have to expand to if (!myCategory().isEnabled()) {} else
>
> Well, we can't, since the << arguments are not part of the macro :) That would end up with s.th. lie
>
> if (!myCategory().isEnabled()) { QMessageLogger(__FILE__, __LINE__, __FUNCTION__).debug() {} else {} << "Hello World";
>
> which doesn't compile.
This is only a problem because you insist on creating partial statements
with the macro instead of full statements.
If the "streaming syntax" would be
qFoo(myCategory(), a << b << c);
instead of
qFoo(myCategory()) << a << b << c;
there's no "else" to worry about, and it would also solve the problem of
a "compile time" "null stream":
#define qFoo(stream, stuff) /*nothing*/
We had this discussion before.
Andre'
More information about the Development
mailing list