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: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Mon, 20 Sep 2021 19:47:54 +0300
On Mon, 20 Sept 2021 at 19:37, Ryan McDougall via SG21
<sg21_at_[hidden]> wrote:
>
> Can you help me understand the concern here -- is it that C will have to update its grammar to recognize this syntax as not ignorable, and they would rather not?

I can't speak for Aaron's concerns, but based on his excellent
explanation, I have mine, which I'd wager are mighty similar to his:

1) our design goal for the syntax is that it's sufficiently
incompatible so that older compilers don't just half-accidentally
ignore-chomp it.
2) we're failing to meet that design goal, because an older C-compiler
can ignore-chomp it and diagnose it
as "attribute ignored". The syntax is not sufficiently different for a
conforming older C-compiler not to mistreat
it, and we fail to achieve the goal of a compiler syntax-checking the
contract annotation.
3) in other words, the C compiler took our program, and treated it in
a conforming way, it diagnosed a syntax
error with a very misleading diagnostic, but was fully-conforming all the way.

Fixing a newer C standard to require that there's additional checks
doesn't fix this problem. The older compilers
can still chomp+diagnose the new syntax in a manner that's conforming
to the old rules, without performing
the syntax-checking that we desperately want.

Received on 2021-09-20 11:48:08