Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Sort of trivial code challenge - may be interesting to you anyway Date: Wed, 04 Mar 2026 01:07:18 -0800 Organization: None to speak of Lines: 60 Message-ID: <87wlzsj73t.fsf@example.invalid> References: <10n80sc$3soe4$1@dont-email.me> <86v7feei2e.fsf@linuxsc.com> <20260302110720.00007698@yahoo.com> <86qzq2e1u3.fsf@linuxsc.com> <10o4ilk$1bo87$1@dont-email.me> <86ikbdebo8.fsf@linuxsc.com> <10o7he5$2cb17$1@dont-email.me> <10o7ku0$1effk$1@dont-email.me> <10o8o59$2nju7$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Wed, 04 Mar 2026 09:07:19 +0000 (UTC) Injection-Info: dont-email.me; posting-host="a132efd78a76e9218f6fcd00d1f9ddce"; logging-data="2917979"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+f9Nc7uBGKiaWULmSNbXMj" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:zch4WJgo78GRHrUkhNWRVS6SijY= sha1:SfvimPMiUJYdLQ9DyxFOdliySS8= Xref: csiph.com comp.lang.c:396750 David Brown writes: > On 03/03/2026 22:47, Janis Papanagnou wrote: >> On 2026-03-03 21:48, Bart wrote: >>> On 03/03/2026 05:15, Tim Rentsch wrote: >>>> [...] >>> >>> This kind of challenge can be done in any language. My algorithm >>> can be trivially converted to C if needed; it is clear enough. >> Sure. But let's have a closer look... >> It's debatable whether the algorithm is the challenge or whether >> writing actual "C" code is the challenge, say, because "C" may >> be so convoluted or just inappropriate for such tasks that it's >> difficult to solve such challenges with the "C" language. - But >> obviously this challenge is not challenging the "C" language in >> any way; it's an ordinary ("C", or other) programming task.[*] >> So I basically agree with you.[**] >> Though, with the subsequent refinements, to abstain from certain >> types of language constructs, i.e. programming with one arm tied >> behind your back, the question is not as clearly to answer; it's >> just easier to compare the various variants and code evolutions >> if you have a common language base (and here in CLC that's "C"). > > The original challenge is a C coding challenge, because it is posted > in a C language group. But it seems entirely reasonable to code it > first in a different language to get a feel for it, and see what the > output is. After all, if you were to ask regulars in this group to > write code for this task without any restrictions on the language, a > fair proportion would reach for languages other than C (I'd expect > mostly Python, but some C++ and some other languages). > > As for the later challenges, these are not C programming > challenges. There are just a set of arbitrary silly limitations. A C > coding challenge asks for C code, and any restrictions should come > from the C world. For example, you could ban the use of dynamic > memory because some C programming environments ban that. You could > ban recursive functions, because some C programming environments ban > that. Ban "for" and "while", and you are not programming in C. If > people find that sort of thing fun, that's fine - but don't expect > anyone else to be impressed by it. > > In light of this, Tim's reply to Bart is not only childish, petty and > unhelpful, but it was also hypocritical. He is no longer talking > about programming in C himself. I disagree. Banning "for" and "while" is an arbitrary restriction, but a C program with no "for" or "while" is still a C program. If you're not interested in such a challenge, perhaps because you think the restriction is silly, that's fine, but this is still comp.lang.c. Showing how to accomplish something in C without "for" and "while" may or may not be of interest to you, but it's topical. Posting a solution in C++ or some other language, with or without "for" and "while", would be inappropriate. (Starting with some other language, treating it as pseudo-code, and then translating the solution to C might be appropriate, but I don't think anyone here has done that.) -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */