[PATCH] manual/stdio: Clarify putc and putwc
Florian Weimer
fweimer@redhat.com
Mon Jul 29 12:09:31 GMT 2024
* Arjun Shankar:
> diff --git a/manual/stdio.texi b/manual/stdio.texi
> index f5e289d58a..c3066114d2 100644
> --- a/manual/stdio.texi
> +++ b/manual/stdio.texi
> @@ -903,21 +903,23 @@ This function is a GNU extension.
> @deftypefun int putc (int @var{c}, FILE *@var{stream})
> @standards{ISO, stdio.h}
> @safety{@prelim{}@mtsafe{}@asunsafe{@asucorrupt{}}@acunsafe{@acucorrupt{} @aculock{}}}
> -This is just like @code{fputc}, except that most systems implement it as
> +This is just like @code{fputc}, except that it may be implemented as
> a macro, making it faster. One consequence is that it may evaluate the
> @var{stream} argument more than once, which is an exception to the
> -general rule for macros. @code{putc} is usually the best function to
> -use for writing a single character.
> +general rule for macros. Therefore, @var{stream} should never be an
> +expression with side-effects. @code{putc} is usually the best function
> +to use for writing a single character.
> @end deftypefun
I would drop the performance claim. On glibc, there is no difference
(and we should merge the two implementations we have of the same
function).
Thanks,
Florian
More information about the Libc-alpha
mailing list