Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: Sort of trivial code challenge - may be interesting to you anyway
Date: Thu, 05 Mar 2026 14:04:42 -0800
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <864imuc4qt.fsf@linuxsc.com>
References: <10n80sc$3soe4$1@dont-email.me> <86v7feei2e.fsf@linuxsc.com> <10o53k6$1i0ef$2@dont-email.me> <86ms0peby6.fsf@linuxsc.com> <10ockdh$3qpk6$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Thu, 05 Mar 2026 22:04:48 +0000 (UTC)
Injection-Info: dont-email.me; posting-host="e10200766ffc466ebfe6a0b9c1907eec"; logging-data="177772"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+StVs4IMFPH7Cj22kQH0WwXABzGK2HIrA="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:8lwB5cdQpdWbXf843rP5Y7NOuG0= sha1:UAM1jAhyXMVnUEWYxYbIJTiBZV0=
Xref: csiph.com comp.lang.c:396798
Lew Pitcher writes:
> On Mon, 02 Mar 2026 21:09:21 -0800, Tim Rentsch wrote:
> [snip]
>
>> The latest challenge, which I just got through doing, is to
>> disallow if, for, while, goto, return, and to forbid functions
>> and function calls except for calls to C standard library
>> functions. Also no math library. :)
>
> Inventive, aren't you :-)
Yes I do enjoy looking at alternative approaches. Guilty as
charged. :)
> I've got a working matrix print that (I think) satisfies your
> requirements, but have not started on the argument processing
> logic yet. I may, yet again, revise my approach, as the solution
> I'm using is quite tedious to code.
Yeah, argument processing is a bitch, especially if you want to
guard against malformed invocations. It's vaguely satisfying to
find an approach that doesn't suck.
>> The program is a bit on the long side because of argument
>> processing but the matrix print code is less than 20 lines,
>> including 5 blank lines.
>
> 20 lines, including 4 blank lines, but I can reduce it a bit.
> I should be able to match (or at least approximate) your line
> count.
I've just gone through my first (and probably last) rewrite, and
the result is a lot cleaner. I won't say more just now, and let
you continue on your current path.