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: Sat, 07 Mar 2026 11:55:13 -0800 Organization: A noiseless patient Spider Lines: 29 Message-ID: <86seab9zz2.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> <10ocrjn$3qpk6$2@dont-email.me> <10od64s$3qpk6$4@dont-email.me> <86ikb9bmtw.fsf@linuxsc.com> <10oem5t$n5hk$1@dont-email.me> <10ohqc1$1m7c1$3@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Sat, 07 Mar 2026 19:55:20 +0000 (UTC) Injection-Info: dont-email.me; posting-host="fa47ee131b44f7fa0236e5dadd002153"; logging-data="1894650"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18z03j7pN1xexk/u1rWxLIruGphnC4q0Y4=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:7CmFhYUAEJl+/mbcvqsL1M20qcY= sha1:b1zg+6D5D2NOl0HhAaDMobK2nEQ= Xref: csiph.com comp.lang.c:396850 Lew Pitcher writes: > On Fri, 06 Mar 2026 13:51:58 +0000, Lew Pitcher wrote: > [...] >> I'll look at revising my code, in the light of your comments, and >> repost with a more "legal" version. > > And, here it is > [...] First of two responses 1. I think your error checking is more thorough than what I did. I do check that inputs are well formed but it's possible that out of range values will give inappropriate results. 2. I don't have any error return. I do diagnose various conditions (and in particular the no-square-possible cutoff values) but don't bother with status. It would be easy to add but I didn't do it. :) 3. How setjmp() is used is still out of bounds. The rule for setjmp() in a switch() is the setjmp() must be the entire expression that is switched on. Effectively longjmp() can pass only constant values, because there is no way to do anything with the value except see if it is true or false (in an if()) or match it against 'case' labels. My code in the next followup.