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: Tue, 10 Mar 2026 15:29:12 -0700 Organization: None to speak of Lines: 28 Message-ID: <877brj2u9z.fsf@example.invalid> 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> <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> <10onrkk$3s7id$2@dont-email.me> <10opulu$hpeb$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Tue, 10 Mar 2026 22:29:14 +0000 (UTC) Injection-Info: dont-email.me; posting-host="3910b6dc5d90e35cad7228c22c833e45"; logging-data="672827"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18GAwvqI54ztQ8EMs9yUWam" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:G3sR70X8TmouQjl+zyxrCltVq6U= sha1:IoolPl2mjOjrqFV+dtq16AxAtYo= Xref: csiph.com comp.lang.c:396890 Bart writes: > On 10/03/2026 01:20, DFS wrote: >> On 3/8/2026 3:29 PM, Bart wrote: >>> note that setjmp/longjmp are not functions >> huh? >> https://man7.org/linux/man-pages/man3/longjmp.3.html > > I was wrong, there in func some C libraries that use functions. You were right about setjmp, which is a macro. You were wrong about longjmp, which is a function (but like any library function it can additionally be implemented as a macro.) > Such as MSVCRT (but it didn't work when I tried it just now from > another language). > > It might explain why 'setjump' works in such an unintuitive way: not > only it is it used to set (implicitly) a recovery point, but that > point must be this exact same function call. I'm not sure how else it could work. I could imagine an alternative setjmp() that specifies a recovery point other than the call itself, but you'd need a way to specify that point. (A label wouldn't work, since setjmp and longjmp work across functions.) -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */