C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] [isocpp-sg21] Telecon to review P2388R1 Minimum Contract Support: either Ignore or Check_and_abort

From: Uecker, Martin <Martin.Uecker_at_[hidden]>
Date: Tue, 21 Sep 2021 21:15:39 +0000
Am Dienstag, den 21.09.2021, 23:02 +0200 schrieb Jens Maurer:
> On 21/09/2021 20.54, Uecker, Martin via Liaison wrote:
> > Am Dienstag, den 21.09.2021, 10:06 -0700 schrieb Ryan McDougall:
> > > It should *not* be ignorable in my opinion, because ignoring runs counter
> > > to the purpose of the feature
> >
> > You mean that a compiler should not be allowed to ignore it
> > when in "enforcing" mode and that a compiler that does not
> > support this feature should fail during compilation? Correct?
>
> I think this "ignorable" discussion is misguided.
>
> As far as I understand, it is explicitly desired that all
> conforming implementations diagnose syntactically ill-formed
> precondition / postcondition expressions.

But this is completely independent of
the choice of the syntax.

Only for old compilers (i.e. then non-conforming to
a new standard) it matters:

- With attribute syntax they would simply
ignore the contracts.

- With new syntax (as proposed) they would fail.
(except with loose non-conforming parsing of
attributes)

- With macros one could possible
design a feature where also old compilers check
the syntax. (I am not proposing this).

Martin


> Once that is ascertained, whether those expressions are
> actually evaluated, is a different issue
>
> (Personally, I think contracts should be a first-level
> language feature that should not be hidden inside an
> attribute-looking syntax atrocity. At least in C++,
> the space where they are does allow for context-sensitive
> keywords without much hassle; cf. override and final.)
>
> Jens
>

Received on 2021-09-21 16:15:49