C++ Logo

sg15

Advanced search

Re: [isocpp-sg15] [isocpp-sg21] P3835 -- Different contract checking for different libraries

From: Harald Achitz <harald_at_[hidden]>
Date: Fri, 17 Oct 2025 12:03:45 +0200
Thanks Ville,

On the internet I saw someone saying

void fun(Foo* ptr) pre (ptr!=nullpter), pre(ptr->hasData()) { ... }

might be a problem (for the second pre) and should be written like this

void fun(Foo* ptr) pre (ptr!=nullpter && ptr->hasData()){ ... }

is that true?

Thanks, Harald


On 2025-10-17 10:43, Ville Voutilainen wrote:
> On Fri, 17 Oct 2025 at 11:22, Harald Achitz via SG21
> <sg21_at_[hidden]> wrote:
>> A short question:
>>
>> is it true that it is not specified how often and in which order contracts (pre post conditions) are evaluated,
>> and if it is, I wonder what is means for 'as close as possible'
> See [basic.contract.eval]/18, [expr.call]/7, and [expr.call]/9.

Received on 2025-10-17 10:03:50