Article View: comp.std.unix
Article #160ANSI C symbols supported by POSIX
From: Fred Zlotnick
Date: Thu, 15 Mar 1990 20:02
Date: Thu, 15 Mar 1990 20:02
46 lines
2414 bytes
2414 bytes
From: fred@mindcraft.com (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
getc(stdin).
...the POSIX standard defines the symbol STDIN_FILENO as the
file descriptor associated with stdin (8.2.1.2), 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@mindcraft.com | of any other highway to ride."
...!{decwrl,ames,hpda}!mindcrf!fred |
Volume-Number: Volume 18, Number 75
Technical Details
Message-ID:
<563@longway.TIC.COM>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!brutus.cs.uiuc.edu!unix.cis.pitt.edu!zaphod.mps.ohio-state.edu!samsung!cs.utexas.edu!longway!std-unixShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!brutus.cs.uiuc.edu!unix.cis.pitt.edu!zaphod.mps.ohio-state.edu!samsung!cs.utexas.edu!longway!std-unix From: fred@mindcraft.com (Fred Zlotnick) Newsgroups: comp.std.unix Subject: ANSI C symbols supported by POSIX Message-ID: <563@longway.TIC.COM> Date: 15 Mar 90 20:02:46 GMT Sender: std-unix@longway.TIC.COM Reply-To: std-unix@uunet.uu.net Organization: Mindcraft, Inc. Lines: 46 Approved: jsq@longway.tic.com (Moderator, John S. Quarterman)