Path: csiph.com!news.mixmin.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: Christmas Quiz 2022
Date: Mon, 26 Dec 2022 06:25:44 -0800
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <86lemuw8bb.fsf@linuxsc.com>
References: <20221220054654.91@kylheku.com> <87tu1quou7.fsf@bsb.me.uk> <87ili6unpn.fsf@bsb.me.uk> <87pmceq6k2.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader01.eternal-september.org; posting-host="b017513bf0c3c2565b748ac271e0e545"; logging-data="3458102"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+kaADCD2nXGM65YtDvQQu/hD+a9g0bJfQ="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:sezKU4UjGa1XMwINifVkfVJQGbE= sha1:Wgw7cI6ojasCknpvw5cWo7fP1vo=
Xref: csiph.com comp.lang.c:168638
Keith Thompson writes:
> Lew Pitcher writes:
>
>> On Tue, 20 Dec 2022 15:03:36 +0000, Lew Pitcher wrote:
>>
>>> On Tue, 20 Dec 2022 14:57:56 +0000, Ben Bacarisse wrote:
>>
>> [snip]
>>
>>>>> The notable point is that the semicolon between clause-1 and
>>>>> expression-2 is /not/ part of clause-1, but is, instead part of the
>>>>> for statement itself.
>>>>
>>>> But that does not help if the grammar for a declaration still includes
>>>> a semicolon. I wonder what all the relevant parts of the draft you are
>>>> referring to look like when taken together.
>>>>
>>>>> Because of this, I don't believe that your count can be correct.
>>>>> But, I'm willing to be educated on this :-)
>>>>
>>>> Well, I did add (but then deleted) that the count depends on how the
>>>> grammar is structured. I should look at a more recent draft that will
>>>> have taken the confirmed C11 text as a starting point. I might do that
>>>> later, but I am in a rush!
>>>
>>> Perhaps I've got an outdated copy of the draft standard, and the semi-
>>> colon question was asked and answered in a later release.
>>>
>>> Your explanation sounds valid to me. 'Tis a puzzle to be resolved later.
>>
>> Oops... I found it.
>>
>> Under 6.8.5 Iteration statements
>> Syntax
>> ...
>> for ( expression ; expression ; expression ) statement
>> for ( declaration expression ; expression ) statement
>>
>> (all expressions are marked optional)
>>
>> Crisis averted. You are indeed correct, and I've learned something
>> new today. :-)
>>
>> But, that doesn't explain why 6.8.5.3 ("the for statement") shows
>> the syntax it does. Perhaps the draft missed something in resolving
>> the text between 6.8.5 and 6.8.5.3.
>
> Summary: You've found a bug in the standard, and not just in the draft.
> [...]
Not a bug. Please see my last response to Lew Pitcher
in this thread.