[Development] Disavowing the Lakos Rule for Q_ASSERT

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Tue Aug 27 11:59:34 CEST 2024


On 27/08/2024 04:03, Thiago Macieira wrote:
> I also urge you to expand on the case of std::vector::operator[]. Are you
> proposing that it a) become non-noexcept, b) have its UB not defined by the
> boundary of the precondition, or c) have a precondition that cannot be turned
> into an exception?

It's not noexcept in the Standard; implementations just chose to make it 
so. Libstdc++ chose¹ to have always-terminating precondition 
enforcement, i.e. the checks never throw, and so doesn't operator[].

We can decide otherwise -- and that's orthogonal to if and when 
contracts actually land, as Marc says.


¹ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58338#c17

-- 
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: S/MIME Cryptographic Signature
URL: <http://lists.qt-project.org/pipermail/development/attachments/20240827/624cefbf/attachment.bin>


More information about the Development mailing list