C++ Logo

std-proposals

Advanced search

Re: [std-proposals] P4334R0 C++ Contracts

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Thu, 20 Aug 2026 08:42:31 +0300
On Wed, 19 Aug 2026 at 13:27, Jens Maurer <jens.maurer_at_[hidden]> wrote:

> For your particular godbolt example, I notice that v.size() returns a size_t,
> which is unsigned, causing conversion to unsigned values across the conditions.
> The if-condition is thus wrong for "use_sound", because
> v.size() == 1 and idx == 5 yields "large unsigned number" > 10",
> which is unexpectedly true.

Well spotted, thank you very much. The implementation has now been
improved to handle
mixed-signedness compares better: https://godbolt.org/z/55jWWr11W

Received on 2026-08-20 05:42:51