C++ Logo

liaison

Advanced search

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

From: Niall Douglas <s_sourceforge_at_[hidden]>
Date: Fri, 06 Oct 2023 07:59:47 +0000
On 06/10/2023 06:31, Martin Uecker via Liaison wrote:

> A syntax as proposed here (it seems, correct me if I am wrong) such
> as:
>
> void f(int x)
> pre <audit> (x > 0);
>
> would be a pretty bad choice for C.

What if the syntax were more C-ish?

void f(int x)
    pre[audit](x > 0);

Or:

void f(int x)
    pre_audit(x > 0);

Or:

void f(int x)
    pre(audit, x > 0);

Niall

Received on 2023-10-06 07:59:49