Re: On C99, C11, and other dialects
Matthias Andree via Mutt-dev <[email protected]>
| Newsgroups | gmane.mail.mutt.devel |
|---|---|
| Message-ID | <[email protected]> |
Am 20.04.26 um 18:15 schrieb Steffen Nurpmeso: > Hello Alejandro. > > Alejandro Colomar via Mutt-dev wrote in > <aeP4WD47Pch3b5UT@devuan>: > |On 2026-04-18T02:10:17+0200, Steffen Nurpmeso wrote: > |[...] > |> I never used the standard library until i took maintainership of > |> that MUA, really. (fprintf(3), but only as the last possibility > |> in case of debug havoc.) We had (or could) -nostdlib (on Linux; > |> but needed -ldl), dtors, ctors, (ifuncs), this all not used > |> (-fno-rtti and all that), so it was wonderful. > | > |Hmmm, then yes, that would count as C89. It's quite rare, as these days > |almost every program uses POSIX or C99 library stuff, such as > |snprintf(3). > > Libraries seem to have detoriated thus, in that, i think compiling > on a twenty year old system will currently really fail, also > because of snprintf for example. (Originally there was a "lazy > wrapper" which simply called vsprintf().) > But it is on the list and not forgotten. I would advise not to waste time and brain cycles for open source on getting network-related code -- or generally code that needs to support inputs you don't control -- to run on 20-year-old systems with insufficient library support that make you write 20 lines of situation and error checking for a job you get done with three in a modern variant of your programming language and one in another. We've seen mutt maintainers come and go over the years. > That standard format I/O, for example, i never liked, i will > port the "format codec", one day. (Just a(n) (restartable) > object that does it, being fed from the front instead of > calling pointer-to-function from the back, as some I/O libraries > implemented the *f() series, at one time, at least. With it, > non-restartable (eg stack buffer) is then simply > > Txt::FormatDecoder fd; > ... > if(_cplen == M1::ui4) > _cplen = length(_cp); > (void)fd.setup(_cp, _cplen, _fmt, _valistp) > .setRestartable(fal0) > .call(); > _cplen = ((fd.isFinished() || 0 != fd.numberOfConversions()) > ? fd.numberOfAssignments() > : M1::ui4); > return _cplen; > > which is so much better than anything else thinkable.) Wasting time on solved problems seems to be a hobby project in itself, but not useful if you don't have it now but want your application (such as mutt) written and progress.