Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: Programming exercise/challenge
Date: Sat, 02 Jan 2021 18:02:22 -0800
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <86y2hasrpt.fsf@linuxsc.com>
References: <86wnxwkyol.fsf@linuxsc.com> <86eej7usal.fsf@linuxsc.com> <20201231165401.0079f4d95a8c7c746de42e91@gmail.com> <86k0swu0ix.fsf@linuxsc.com> <20210102215921.70d75313b9e3a327ca824630@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="ba2c00f638f312455dfdd19ce649c4ad"; logging-data="11800"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19FZEHy0lsSKAUgIWvWDwwybr8DhO1wDaQ="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:hD+w+ydM1CmrT+nNcEzakNY/MSE= sha1:nKxa35Ovm2GpI72VG0kypH7n4RM=
Xref: csiph.com comp.lang.c:158117
Anton Shepelev writes:
> Tim Rentsch:
>
>> In section 6.4.4.4, the C standard gives that part of C's
>> lexical grammar that pertains to character constants. The
>> grammar rules given allow an arbitrary number of "c-char"
>> in between the enclosing single quotes, and that
>> definition is what these decommenting programs should
>> accept. More generally, they should accept any lexically
>> well-formed input, and that includes arbitrarily long
>> character constants.
>
> Thanks for the clarification, Tim. The only incorrect
> character constant seems to be an empty one -- '' ?
In terms of lexical well-formedness, yes, I believe that's
right. Let me say also that even though an empty character
constant is not well formed as far as the C standard is
concerned, I expect that any self-respecting de-commenting
program would process it without complaint.