This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH v2 2/5] Remove getc and putc macros from the public stdio.h.
On Mon, 5 Feb 2018, Zack Weinberg wrote:
> diff --git a/NEWS b/NEWS
> index 3ac57eca4ee..eceab2b2be2 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -15,6 +15,13 @@ Deprecated and removed features, and other changes affecting compatibility:
> [Add deprecations, removals and changes affecting compatibility here]
> + * The stdio.h functions 'getc' and 'putc' are no longer defined as macros.
> + This was never required by the C standard, and the macros just expanded
> + to call alternative names for the same functions. If you hoped getc and
> + putc would provide performance improvements over fgetc and fputc, instead
> + investigate using (f)getc_unlocked and (f)putc_unlocked, and, if
> + necessary, flockfile and funlockfile.
The "[Add deprecations, removals and changes affecting compatibility
here]" placeholder should be removed by this patch, as the first one to
put something in this section for 2.28.
The patch is OK with that change.
There is a theoretical use for implementation-namespace aliases of even
C90 standard functions such as getc and putc - properly, if a function is
used in a *macro* defined in a standard header, it should be used via such
an alias to avoid possible shadowing of the standard function name by a
block-scope variable in a scope where the macro is used (standard function
names aren't generally reserved with block scope). But that doesn't
affect this patch at all, since there are no such macros making use of
either getc or putc (and in any case, the _IO_getc and _IO_putc function
exports still exist should they prove to be of use in future, and any
aliases for this issue could be defined in headers with asm redirection
without needing library exports at all).
Joseph S. Myers