[Development] Disavowing the Lakos Rule for Q_ASSERT

Ville Voutilainen ville.voutilainen at gmail.com
Tue Aug 27 00:25:40 CEST 2024


On Mon, 26 Aug 2024 at 23:25, Fabian Kosmale via Development
<development at qt-project.org> wrote:
>
> Hi,
>
> I'm somewhat sympathetic to Thiago's proposal, but with different reasoning. The Lakos rule is indeed motivated by contracts, and by the fact that the standard is extremely reluctant to do breaking changes.
> Now, contracts will be in no earlier than C++23 even in the best case (and personally I believe 26 is more realistic, but let's see). Given that we're currently very reluctant

C++23 was set in stone a year ago. ISO has been dragging their feet on
publishing it in an amazing manner. So no, Contracts won't be hitting
C++23, that ship sailed.

>  As far as rules go: A function can be noexcept, if it doesn't ever throw exceptions - sounds pithy, but of course that means among other things no allocations, and error handling has to use a non-exception mechanism (be that std::expected  or just  fatal termination).

There's a difference between a function being noexcept and calls to a
function not throwing exceptions. Parameter initialization
can throw without terminating, for a call of a noexcept function.


More information about the Development mailing list