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: Jens Maurer <Jens.Maurer_at_[hidden]>
Date: Mon, 20 Sep 2021 21:22:29 +0200
On 20/09/2021 21.17, Uecker, Martin via Liaison wrote:
> Am Montag, den 20.09.2021, 19:47 +0300 schrieb Ville Voutilainen via Liaison:
>> 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.
>
> Is this somehow different to old C++ compilers?

Really old C++ compilers will see "[[" and complain about
token soup.

I haven't seen a C++ compiler (of any age) that would
recognize "[[" but then ignore contained attribute
entirely.

Jens

Received on 2021-09-20 14:22:40