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, 12 Mar 2026 05:37:22 -0700
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <86a4wd8br1.fsf@linuxsc.com>
References: <10n80sc$3soe4$1@dont-email.me> <10o53k6$1i0ef$2@dont-email.me> <86ms0peby6.fsf@linuxsc.com> <10ockdh$3qpk6$1@dont-email.me> <10ocrjn$3qpk6$2@dont-email.me> <10od64s$3qpk6$4@dont-email.me> <86ikb9bmtw.fsf@linuxsc.com> <10oem5t$n5hk$1@dont-email.me> <86o6kz9zng.fsf@linuxsc.com> <10oi72k$1rss6$1@dont-email.me> <10oid0u$1u9aa$2@dont-email.me> <10ok1sl$2e7mc$1@dont-email.me> <10ok405$2f6sn$1@dont-email.me> <10ok7mt$2e7mc$5@dont-email.me> <10oking$2jsja$1@dont-email.me> <10opuaq$ja1j$2@paganini.bofh.team>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Thu, 12 Mar 2026 12:37:33 +0000 (UTC)
Injection-Info: dont-email.me; posting-host="1986d9d2c01103796c62726b21968759"; logging-data="2123968"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18nenRBaekL3+joDAeNJa/apv3UKRIJHTU="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:GfPOI73ri2p2wyrnMsACaSUW0Cg= sha1:gzpcSSj+eeeXg3WQHiwx3a+Cvhs=
Xref: csiph.com comp.lang.c:396920
antispam@fricas.org (Waldek Hebisch) writes:
>> [...]
>
> People here must be very bored. I have found this challenge rather
> uninteresting (bunch of arbitrary restrictions unlikely to happen in
> real use).
Different people have different interests. Do you think other
people find everything you say interesting?
> And the "use longjmp" variant is especially silly and very specific
> to C: 'longjmp' is an indirect non-local goto so 'no goto' condition
> normally would mean that 'longjmp' is forbiden too. And in most
> languages that can do nonlocal goto-s they are simply called 'goto'.
> So this variant makes no sense in such languages.
Yes, this is comp.lang.c, so it's perfectly appropriate to have
a condition specific to C. The prohibition against 'goto' meant
specifically C's goto statement, not transfer of control; both
'break' and 'exit()' were allowed, for example. Moreover lonjmp
is not at all the same as goto. Even discounting the non-local
aspects, longjmp has capabilities that goto doesn't have, and
also has restrictions that goto doesn't have.
> BTW: I once implemented fibonacci function using explicit stack
> and indirect jumps in PL/I under OS/360. But that showed
> interesting feature: under OS/360 version using indirect jumps
> was faster than version using function calls. I do not think
> that version using 'longjmp' has any speed advantage on modern
> systems.
Performance was never the point of the exercise. Personally I
find long discussions of performance minutia rather boring. But
I don't jump in just to complain about them.