[Development] Disavowing the Lakos Rule for Q_ASSERT

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Mon Aug 26 21:27:47 CEST 2024


Il 26/08/24 19:56, Thiago Macieira ha scritto:
> I'd like to request Qt code not obey that rule. In my opinion, it's a defect
> in the contract implementation rather than on Qt code. The*pre*  condition
> indicates something that must be true before the method is called and
> therefore the method's own noexcept specification does not apply*yet*.

As far as I've understood, that's only part of the issue. The other part 
of the issue is that code calling the function may break: if you turn 
the failed precondition check into an exception, the exception handling 
will need to bubble it up through code which may not have set up the 
correct unwinding state -- because it rightfully assumed that no 
exception would escape out of a noexcept function.

My 2 c,
-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - Trusted Software Excellence

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4244 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/development/attachments/20240826/9307d53b/attachment.bin>


More information about the Development mailing list