C++ Logo

liaison

Advanced search

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

From: Timur Doumler <cpp_at_[hidden]>
Date: Fri, 6 Oct 2023 16:58:12 +0300
Thanks Aaron,

> On 6 Oct 2023, at 16:53, Aaron Ballman <aaron_at_[hidden]> wrote:
> C23 Footnote 186: Standard attributes specified by this document can
> be parsed but ignored by an implementation without changing the
> semantics of a correct program; the same is not true for attributes
> not specified by this document.

Interesting. It seems a bit ambiguous to me what "parsed but ignored" actually means. If we go with the P2935 (attribute-like) syntax for Contracts and you end up having something like this:

[[ assert: x != 0 ]];

Does "parse" mean that you have to actually parse `x != 0` as an expression, since the grammar for contracts says that the thing after the colon is an expression? Or does "when you see `[[`, skip every token until you reach the matching `]]` " also count as "parse"?

Cheers,
Timur

Received on 2023-10-06 13:58:15