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, 12 Dec 2020 19:23:24 -0800 Organization: A noiseless patient Spider Lines: 25 Message-ID: <86pn3e1j9v.fsf@linuxsc.com> References: <86wnxwkyol.fsf@linuxsc.com> <86sg8f43fb.fsf@linuxsc.com> <20201209145102.a4adfe0b03a547724b4a7d5b@gmail.com> <86o8j24vt7.fsf@linuxsc.com> <20201213001736.831b07516475bf6914ff195f@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="b9b2ee0d4c4a5c7f42f81fa91d7a0e4d"; logging-data="18355"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19zsM5oEF9vlPEURebUM3QQ/UgVWRbhK28=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:i6G7ZQWcTsUJ0bg7AXxghbs6mkk= sha1:2YsZ64KBmKP8WHpJ04oxT/+M670= Xref: csiph.com comp.lang.c:157243 Anton Shepelev writes: > Tim Rentsch: > >> It was taken from this page >> >> https://clc-wiki.net/wiki/K%26R2_solutions:Chapter_1:Exercise_23 >> >> and you may want to try looking there for other ideas. > > The program on that page annotead as: > > This program breaks most of the above submissions: > > does not compile even in the original form! In some sense deliberately so. It was written at a time before C99 had achieved widespread adoption, so most C code and most C programmers were not using the // style comments. The program you mention exploits the lack of // comments so that it compiles under C90 rules (at least I'm pretty sure it does) but not under C99 rules. At the point in the program where //* occurs, putting a space between the two /'s should make it compile also under C99 rules. (The foregoing based on my best understanding, I'm not sure if I've tested it.)