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: official library of tiny functions lacking in c Date: Thu, 01 Oct 2026 09:37:21 -0700 Organization: A noiseless patient Spider Lines: 51 Message-ID: <86v77lnzr2.fsf@linuxsc.com> References: <119ajku$15pve$1@dont-email.me> <119gro2$3g678$1@dont-email.me> <119gvoa$3h56b$1@dont-email.me> <119hb3e$lm9$1@reader1.panix.com> <119idn6$3vj3k$1@dont-email.me> <20260930134100.00004ff0@yahoo.com> <868q4hpkfu.fsf@linuxsc.com> <20261001175014.00006ad5@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Thu, 01 Oct 2026 16:37:22 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1421800"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/0gEdi3L+JAGE0Vfr1kufzYbS7szslusU="; posting-host="18a74afe15b7c222d977d31c18068e17" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:CEZWdSvW7xrdc0FlIsGjn4nFNoo= sha1:chbvhFIT4rpXkvfxLo9nLeshoB8= sha256:lQHDmLjxxyhxBB/OEK+MiHrMWz2Qvt5X1OrwnEJMS9Y= sha1:4yjQEfyiMkSw3QmC4j13jWoBHv8= sha256:QrvaHIqYrb+V5NiSO5grPmMm6vUCOchHGt0UCz6w/s4= Xref: csiph.com comp.lang.c:402623 Michael S writes: > On Thu, 01 Oct 2026 07:25:09 -0700 > Tim Rentsch wrote: > >> Michael S writes: >> >>> On Wed, 30 Sep 2026 09:28:38 +0200 >>> David Brown wrote: >>> >>>> On 29/09/2026 23:37, Dan Cross wrote: >>>> >>>>> In article , >>>>> Scott Lurndal wrote: >>>>> >>>>>> There is a lot to be said for the terseness of *printf >>>>>> formatting, particularly with compilers that check the type >>>>>> correctness of the printf varargs list. >>>>> >>>>> I'd say the real winning example is `snprintf`, where one can >>>>> format directly into a character array. It is difficult to >>>>> understate the utility this; but if `print` were built into the >>>>> language, you'd lose it, unless you also had a `sprint` builtin. >>>> >>>> snprintf is the printf family member I use most, and occasionally >>>> vsnprintf. >>>> Other people will likely make heavy use of fprintf too. >>>> >>>> And I often use the return value of printf (or rather, snprintf) to >>>> see if I've cut the output short. >>> >>> As was already discussed here 5 years ago, return value of snprintf >>> does not fit my most common usage pattern, which is to add strings >>> to buffer until it is full and to drop silently the remaining parts >>> after buffer is full. I.e. to produce sequences of format calls >>> that behave similarly to an individual snprintf. >>> >>> Interested reader could still find discussion, including code, by >>> searching comp.lang on Google groups for my_snprintf. >>> Unfortunately, with recent breakage of GG I no longer can provide a >>> working link to either individual article or the thread. >> >> I haven't done any searching, but let me ask: did what you posted >> have maybe 15 or 20 lines of code plus a typedef or two? > > Lines of code - yes, not counting lines of comments at the beginning. > Typedef - I don't recollect typedef. > You commented on my code pointing out that an absence of va_end at the > end is non-portable. [and other comments] Oh so I did. Apparently my memory is getting worse as years go by.