home *** CD-ROM | disk | FTP | other *** search
- Submitted-by: willcox@urbana.mcd.mot.com (David A Willcox)
-
- gwyn@smoke.brl.mil (Doug Gwyn) writes:
-
- >There are no requirements on any headers other than those specified in the
- >standard; thus additional facilities can AND SHOULD be defined by separate
- >headers, not through modifications to the standard headers. This is
- >especially important when the standard C implementation is provided by
- >one source of supply but the additional functionality is provided by a
- >different source of supply, as frequently ocurs in this industry.
-
- Doug makes the good point that I glossed over in my original posting,
- that ANSI C only speaks to its own headers. POSIX's feature test macros
- were needed to allow an implementation to make POSIX symbols visible
- when a POSIX application includes ANSI C headers. (<stdio.h>, <limits.h>,
- <errno.h>, <signal.h>, <setjmp.h> are the ones I can think of offhand.
- There may be others.)
-
- ANSI C didn't require feature test macros for non-ANSI headers like
- <unistd.h> or <pwd.h>. Under the ANSI C rules, an implementation can
- do almost anything it wants when an application includes a non-ANSI
- header. However, we felt that it made sense to extend the feature test
- macro concept to all POSIX headers for several reasons:
-
- (1) It is a good way to handle applications that want different
- versions of the standard. (See the posting that started this
- thread.)
- (2) There were, and still are, UNIX(tm)oid systems in the world
- with subtle and unsubtle differences from POSIX. The feature
- test macros allow them to support POSIX applications and
- applications written specifically for those implementations.
- (3) It is more consistent to treat all headers mentioned in POSIX
- the same.
-
- (I'm not sure that we had all of these reasons in mind when we
- originally did it, but they are still good reasons. ;-) )
-
- >As the last acting liaison between X3J11 and P1003, I was heavily involved
- >in getting this issue resolved. 1003.1 did not quite follow X3J11's
- >recommendations, apparently adopting a different view of feature flags,
- >and from what David has said I gather that the repeated message from X3J11
- >to 1003 to not further pollute the standard headers has gotten lost.
-
- I don't think that the message has been entirely lost. See below.
-
- (Speaking only for myself: I don't think that it "pollutes" a header if
- things that are added to a header that are releated to the original
- use of the header, and the additions are only visible to POSIX
- applications.)
-
- >For NEW facilities (i.e. not those inherited from historic implementations
- >of UNIX), use new, distinct headers for defining new interfaces; don't add
- >new symbols (whether or not under control of feature flags) to standard C
- >headers. Please!
-
- I think that that's pretty much what we've been doing. For the most
- part, the new C interfaces have beed added in new headers, not in
- existing ones. 1003.2, 1003.4, and 1003.4a are full of new headers.
-
- It's true, there are some cases where things have been added to ANSI C
- headers:
-
- - New error numbers added to <errno.h>.
- - New limits added to <limits.h>.
- - New signal-related stuff added to <signal.h>
-
- but with the exception of the <limits.h> stuff, the additions are
- reasonably related to what is already in the header, and it seems
- logical to add the new interfaces there. I might be inclined to agree
- with Doug on the <limits.h> additions.
-
-
- Volume-Number: Volume 28, Number 2
-
-