[Development] Disavowing the Lakos Rule for Q_ASSERT

Thiago Macieira thiago.macieira at intel.com
Wed Aug 28 16:13:37 CEST 2024


On Wednesday 28 August 2024 01:07:12 GMT-7 Ville Voutilainen wrote:
> > It starts to get interesting for code that checks on the noexceptness of
> > the content it's calling and use different algorithms. There aren't a lot
> > of those outside of container copy, but they do exist.
> 
> Just checking.. is that a typo? Do you mean container _move_?
> 
> That's by far the most significant case. And if you're using
> vector::operator[] there, you're doing something
> seriously questionable.

I meant copies and moves in general. And I'm saying there aren't a lot beyond 
those, but they exist.

Take for example a union of associative containers: one must verify whether 
the element being inserted is already present in the container with the same 
key. This means the insertions may need to have different code for inserting 
each element in case the *comparison* throws, even if the element copy/move is 
noexcept.

-- 
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/20240828/00fe523a/attachment.bin>


More information about the Development mailing list