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: Wed, 22 Sep 2021 06:16:31 +0000
Am Mittwoch, den 22.09.2021, 08:00 +0200 schrieb Jens Maurer:
> On 21/09/2021 23.15, Uecker, Martin wrote:
> > 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.
>
> Yes.
>
> > Only for old compilers (i.e. then non-conforming to
> > a new standard) it matters:
>
> Every new feature that comes with syntax changes is
> likely unparsable for older compilers.
> C99 VLAs, for example, are just errors in C89.

With attributes we have device designed especially
for extensions that are ignored by compiler that
do not understand them.

> I don't understand why we'd want to make a special
> effort to accommodate older compilers for contracts
> in particular, a major new language feature.

I think it would make a lot of sense for contracts,
because you could start adding them to project that
still need to be compiled with older compiles (this
is important for a lot of projects).

If one decides against it (as the proposal does),
then the choice of syntax is questionable as
it look similar to attributes. I would then expect
similar behavior, e.g. that it does not break
builds on older compilers.

Martin




Received on 2021-09-22 01:16:40