[Development] Disavowing the Lakos Rule for Q_ASSERT

Thiago Macieira thiago.macieira at intel.com
Mon Aug 26 22:30:32 CEST 2024


On Monday 26 August 2024 13:12:55 GMT-7 Thiago Macieira wrote:
> "Q_ASSERT don't affect noexceptness"
> 
> Or
> 
> "noexcept(false) if you call other, noexcept(false) functions from your
> code", which includes all the pthread cancellation points in glibc. Since
> qt_assert is noexcept, Q_ASSERT is not included. This is very easy to
> implement with a static checker.
> 
> We could be more complex, with "Q_ASSERT that check preconditions imply
> noexcept(false) but Q_ASSERT that verify the state of the internal invariant
> against corruption don't". This would not be easy to implement with a
> static checker.

Also don't forget Q_ASSERT disappears in release builds, so we end up with a 
non-noexcept function in release mode that will never ever throw.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Principal Engineer - Intel DCAI Platform & System Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5152 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20240826/b2612002/attachment.bin>


More information about the Development mailing list