This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
putc vs. fputc
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: GCC Development <gcc at gcc dot gnu dot org>
- Date: Fri, 24 Jul 2009 10:37:31 +0200
- Subject: putc vs. fputc
Hello!
The source of gcc uses both, fputc and putc. I would like to do some
janitorial work and change fputc to putc.
The reason is, that in system.h, both of them get redefined to the
corresponding unlock function:
# ifdef HAVE_PUTC_UNLOCKED
# undef putc
# define putc(C, Stream) putc_unlocked (C, Stream)
# endif
...
# ifdef HAVE_FPUTC_UNLOCKED
# undef fputc
# define fputc(C, Stream) fputc_unlocked (C, Stream)
# endif
unlocked_stdio manpage in this case recommends:
<quote>
The four functions getc_unlocked(), getchar_unlocked(),
putc_unlocked(), putchar_unlocked() are in POSIX.1-2001.
The nonstandard *_unlocked() variants occur on a few Unix systems, and
are available in recent glibc. They should probably not be used.
</qoute>
So, if we consider fputc_unlocked to be nonstandard, there is sligt
preference for putc.
Uros.