[Qt-interest] checking the return value of connect
Anton Chernov
mechernov at gmail.com
Tue Jul 12 09:38:22 CEST 2011
ommit some angry configuration projects warnings
#define SUPER_ASSERT( cond ) Q_ASSERT( cond ); Q_UNUSED( cond);
bool ok = connect(...
SUPER_ASSERT( ok );
2011/7/9 Mandeep Sandhu <mandeepsandhu.chd at gmail.com>
> On Fri, Jul 8, 2011 at 9:15 PM, Scott Aron Bloom
> <Scott.Bloom at onshorecs.com> wrote:
> > Be very careful using assert that way.
> >
> > Depending on the assert implementation, it is possible, and likely, the
> > inside of assert is NEVER executed.
> >
> > For instance, look at the definition of Q_ASSERT
> > #if !defined(Q_ASSERT)
> > # ifndef QT_NO_DEBUG
> > # define Q_ASSERT(cond) ((!(cond)) ?
> > qt_assert(#cond,__FILE__,__LINE__) : qt_noop())
> > # else
> > # define Q_ASSERT(cond) qt_noop()
> > # endif
> > #endif
> >
> > If its in debug, the condition is 100% ignore and will not be executed
>
> Very true...in case of a 'release' build, the call inside an Q_ASSERT
> would not be compiled in. Best to do an assert in a separate stmt.
>
> -mandeep
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110712/d115d33f/attachment.html
More information about the Qt-interest-old
mailing list