C++ Logo


Advanced search

Re: [wg14/wg21 liaison] P2961R1 syntax for Contracts: viable for C?

From: Timur Doumler <cpp_at_[hidden]>
Date: Sat, 7 Oct 2023 16:25:59 +0300
> On 7 Oct 2023, at 16:10, Ville Voutilainen <ville.voutilainen_at_[hidden]> wrote:
> That's certainly a possible work-around, but it also always incurs the
> cost of the copy, even though
> you really need the copy only when the contract is checked.

What if the return type is non-copyable non-movable, such as a std::atomic? Not really an issue in C I guess, but definitely an issue in C++. This is one of the reasons why in C++, a fully-featured postcondition facility is impossible to implement with macros and requires a new language feature.


Received on 2023-10-07 13:26:03