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: Tue, 08 Dec 2020 22:49:11 -0800
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <86tusv79ug.fsf@linuxsc.com>
References: <86wnxwkyol.fsf@linuxsc.com> <1VczH.179018$GyS9.167571@fx04.ams4>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="5eb73538a536c16dceb299f9d9a18884"; logging-data="24239"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+F017mmri9jsDu5NdblHiFC+qctrb2UnE="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:UOZ6aZS7J7S4+ewptt6jLUX9Ghg= sha1:+QfyFTirQbhCaVH9EkHrSb2rtu8=
Xref: csiph.com comp.lang.c:157117
Richard Damon writes:
> On 12/7/20 3:37 AM, jacobnavia wrote:
>
>> I corrected that. The problem is that if I read a '*', I read the next
>> character to see if it is a '/' that would close the multi-line comment.
>> If it is NOT, I ignore the character and just go on reading the next
>> character. If the next character is a '/' I ignore it too since it
>> wasn't after a '*', that I discarded!
>>
>> Solution: Just make an ungetc. Corrected version is posted soon.
>
> Been thinking a bit of the problem, and this shows one of the traps in
> it. We are asked to remove the comments but the lines ending in \ being
> connected together aren't in general comments, so unless they are inside
> comments need to be retained, so we can't just remove them at an inner
> level or we are doing an transformation that wasn't in the spec.
Right.