Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #401911
| From | BGB <cr88192@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Trolling the standard thumpers |
| Date | 2026-09-10 15:56 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <117v5i5$2b95p$1@dont-email.me> (permalink) |
| References | <2qLfS.354537$aXr.31321@fx18.ams4> |
On 8/14/2026 4:05 PM, Johann 'Myrkraverk' Oskarsson wrote:
> Dear comp.lang.c,
>
> Because I believe the standard thumpers have trolled us quite well
> for way too long, I'm asking quite casually, if this is a conformant
> implementation of printf()?
>
> int printf( const char *format, ... ) {
> errno = ENOTTY ;
> return -1 ;
> }
>
>
> Happy ENOTTY!
Sort of reminds me of something:
Various C libraries like to essentially implement "vfprintf()" as the
core version of the function and then implement "vsprintf()" and
"vsnprintf()" and similar by wrapping the string as a virtual "FILE"
whose output goes into a string.
I had usually preferred it to be the other way:
"vsnprintf()" is the core, and calls like "printf()" and "fprintf()" are
essentially wrappers that print to a temporary string and then "fputs()"
it to the appropriate output.
This generally allowing for higher performance and being easier to debug
(assuming one doesn't just duplicate all the logic for these functions).
Though, yes, this does imply a limit on how big of a string one can
print using "printf()" and similar; but they are not required to be able
to handle arbitrary large strings, so...
Could almost make sense to define some equivalent of PATH_MAX though for
"printf()" and friends, maybe also applied implicitly to "sprintf()",
though the latter is maybe moot as most typical buffers are likely to be
smaller than a sensible value for such a 'PRINTF_MAX' (say, if this is
in kB territory; would not make sense to go much bigger as by then it is
just needless overkill; but it is not entirely unreasonable to expect
that someone might want to be able to "printf()" a whole screen of text
in one go, even if typical use does not exceed one or two lines at a
time...).
Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll thread
Trolling the standard thumpers Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-08-15 05:05 +0800
Re: Trolling the standard thumpers Kaz Kylheku <046-301-5902@kylheku.com> - 2026-09-10 20:06 +0000
Re: Trolling the standard thumpers Lane W <cactus_DAC@yahoo.com> - 2026-09-10 14:14 -0600
Re: Trolling the standard thumpers fir <profesor.fir@gmail.com> - 2026-09-10 22:33 +0200
Re: Trolling the standard thumpers Lane W <cactus_DAC@yahoo.com> - 2026-09-10 15:03 -0600
Re: Trolling the standard thumpers fir <profesor.fir@gmail.com> - 2026-09-11 13:49 +0200
Re: Trolling the standard thumpers fir <profesor.fir@gmail.com> - 2026-09-11 13:55 +0200
Re: Trolling the standard thumpers Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2026-09-10 14:25 -0700
Re: Trolling the standard thumpers Lane W <cactus_DAC@yahoo.com> - 2026-09-10 15:33 -0600
Re: Trolling the standard thumpers David Brown <david.brown@hesbynett.no> - 2026-09-11 09:37 +0200
Re: Trolling the standard thumpers fir <profesor.fir@gmail.com> - 2026-09-11 14:00 +0200
Re: Trolling the standard thumpers Lane W <cactus_DAC@yahoo.com> - 2026-09-11 07:18 -0600
Re: Trolling the standard thumpers Tim Rentsch <tr.17687@z991.linuxsc.com> - 2026-09-18 08:22 -0700
Re: Trolling the standard thumpers BGB <cr88192@gmail.com> - 2026-09-10 15:56 -0500
csiph-web