C++ Logo


Advanced search

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

From: Martin Uecker <ma.uecker_at_[hidden]>
Date: Sat, 07 Oct 2023 15:34:39 +0200
Am Samstag, dem 07.10.2023 um 16:25 +0300 schrieb Timur Doumler:
> > 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.

Yes, but the point is not whether it is implementable as
a macro, but that it could be wrapped inside a macro
without changing the appearance of the code.


Received on 2023-10-07 13:34:42