This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]