ANSI C symbols supported by POSIX

Fred Zlotnick fred at
Fri Mar 16 06:02:46 AEST 1990

From: fred at (Fred Zlotnick)

In Mark Horton's new book, Portable C Software (Prentice-Hall), there are
tables describing which symbols are supported from which headers in each
of various systems and standards.  Looking at the table for <stdio.h>, I
noticed that the symbols stdin, stdout and stderr are marked as not
supported in POSIX.  At first I thought that this was an error, but now
I'm not so sure.

General question:
	Which symbols from the ANSI C header namespace are guaranteed to
	be available to a Strictly Conforming POSIX Application?

Specific question:
	Can a Strictly Conforming POSIX Application use "stdin", for
	example by calling "getc(stdin)"?

Arguments about the specific question:
Yes, because...
	...the POSIX standard supports getchar(), whose semantics are
	   adopted from the C Standard where they are defined to be
	...the POSIX standard defines the symbol STDIN_FILENO as the
	   file descriptor associated with stdin (, so by
	   implication stdin is supported.

No, because...
	...The POSIX Standard specifically names the symbols and terms
	   adopted from the C Standard, in section 2.8.1, and stdin is
	   not among them.

Obviously similar arguments exist about stdout/stderr.  Note that the
symbols stdin, stdout and stderr are unambiguously part of the reserved
name space (at least, if _POSIX_SOURCE is defined in the right place.)
That's not the issue, though, as the names "signal" and "mbtowc" are also
part of the reserved name space but those functions are not supported.

Fred Zlotnick
Fred Zlotnick                       |	"You can't overlook, the lack, Jack,
fred at                  |	 of any other highway to ride."
...!{decwrl,ames,hpda}!mindcrf!fred |

Volume-Number: Volume 18, Number 75

More information about the Comp.std.unix mailing list