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: Wed, 11 Mar 2026 07:07:09 -0700 Organization: A noiseless patient Spider Lines: 48 Message-ID: <868qbya29e.fsf@linuxsc.com> References: <10n80sc$3soe4$1@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> <87bjgv2ugg.fsf@example.invalid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Wed, 11 Mar 2026 14:07:11 +0000 (UTC) Injection-Info: dont-email.me; posting-host="5f44bcdbc02769ce6998caa4a4cb2206"; logging-data="1172321"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19M3T3oSsAi7KHufb/McJS+GjQnRgT/iwo=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:dMqwNlQQgT3IeJnufi05rlL3YsE= sha1:0n2Zw34qsXxqJ2X4FQ9H3TyaYSU= Xref: csiph.com comp.lang.c:396902 Keith Thompson writes: > scott@slp53.sl.home (Scott Lurndal) writes: > >> DFS writes: >> >>> 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 >> >> POSIX allows setjmp to be defined as a macro. >> >> https://pubs.opengroup.org/onlinepubs/9799919799/functions/setjmp.html > > More to the point, ISO C (all editions from C90 to C23) specifies that > setjmp is a macro, and longjmp is a function. (Like any library > function, longjmp can *also* be implemented as a macro). > > As it happens, glibc's has: > > #define setjmp(env) _setjmp (env) > > where _setjmp is a function. > > POSIX says: > > It is unspecified whether setjmp() is a macro or a function. If > a macro definition is suppressed in order to access an actual > function, or a program defines an external identifier with the > name setjmp, the behavior is undefined. > > which may be inconsistent with ISO C. The original ANSI C standard says this: It is unspecified whether setjmp is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function, or a program defines an external identifier with the name setjmp, the behavior is undefined. I think every version of the ISO C standard says exactly the same thing. I did a quick check but didn't verify that the wording is exactly identical in every case.