On Tuesday, 27 de September de 2011 09:48:29 Joerg Bornemann wrote:
> On Sat, 2011-09-24 at 14:44 +0200, ext Stefan Majewsky wrote:
> > Why isn't there any variant of Q_ASSERT that expands like
> > 
> > #define Q_ASSERT_ALT(x) x;
> > 
> > in release builds? If it's a simple value check like Q_ASSERT_ALT(x >
> > 0), the compiler will optimize the effect-less statement away.
> 
> The standard assert macro in assert.h behaves the same. It does nothing
> as soon as you define NDEBUG.
> Having a Q_ASSERT_ALT macro (whatever its gonna be named) is IMHO
> confusing and not of much value.

If you need something like that, it's very easy to write:

        bool check = your code goes here;
        Q_ASSERT(check); Q_UNUSED(check);

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Qt5-feedback mailing list
Qt5-feedback@qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback

Reply via email to