[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Some thoughts on kdelibs et al.
From: Lubos Lunak <l.lunak () sh ! cvut ! cz>
Date: 2001-09-28 18:04:34
[Download RAW message or body]
Dne st 26. záøí 2001 18:25 Marc Mutz napsal(a):
[snip]
>
> And... Using Q_ASSERT everywhere instead of assert and defining
> -DQT_FATAL_ASSERT in the Makefiles?
>
I don't see any difference between Q_ASSERT and assert, besides Q_ASSERT
being a bit broken. Guess why the following fails only when using assert:
#include <qglobal.h>
#include <assert.h>
int main()
{
int a = 2;
if( a == 0 )
#if 1
Q_ASSERT( a == 0 );
#else
assert( a == 0 );
#endif
else
Q_ASSERT( false );
}
One of the ways how to correctly #define Q_ASSERT is :
#define Q_ASSERT(x) \
((x) ? (void)0: qFatal("ASSERT: \"%s\" in %s (%d)",#x,__FILE__,__LINE__))
In general, function-like macros should expand either to an expression or to
statements enclosed in ' do { ... } while( false )'.
Lubos Lunak
--
llunak@suse.cz ; l.lunak@kde.org
http://dforce.sh.cvut.cz/~seli
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic