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 07:25:09 -0700
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <868q4hpkfu.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>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Thu, 01 Oct 2026 14:25:12 +0000 (UTC)
Injection-Info: dont-email.me; logging-data="1275193"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19azLyxbUPZKR7rbs3pADKNd0T3kapTZpQ="; posting-host="18a74afe15b7c222d977d31c18068e17"
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:3tncbSj1ED6nw6XpvlxKEx5pJMY= sha1:XyPsYli9nsvqogNcrk5vt9Wu7DI= sha256:VsoFrstwQmbqfbtzvhexq9bzyNdyC6x1GczPLJjbOKc= sha1:YHgauhkxhz3IAIWfB/t438U9ZAQ= sha256:9yjSdyxC/zQNH5crtIxx0B9fshr3xjp+9918hX7OWhQ=
Xref: csiph.com comp.lang.c:402620
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?