home *** CD-ROM | disk | FTP | other *** search
- Submitted-by: karish@mindcraft.com (Chuck Karish)
-
- srini@hpcuhe.cup.hp.com (Sreenivasa Rao Tellakula) wrote:
- >If I have two prototypes for the same function, one is posix version
- >and one is non-posix and if I have to put them in the header file, what
- >ifdef I have to use? Can I use _POSIX_SOURCE?
-
- Yes, assuming that the first "int *" in the second prototype is
- a typographical error that will be corrected. This is a perfectly
- appropriate use for _POSIX_SOURCE.
-
- The #ifdef is not needed if gid_t is an int on your system. The
- definition could be expressed just as
-
- extern int getgroups (int, int *);
-
- See POSIX.1-1990, page 33, lines 940-946.
-
- >If correct, this means all posix programs
- >needs to be compiled with cc -D_POSIX_SOURCE and is this an acceptable
- >constraint?
-
- This is not only acceptable, it is required. When compiling a
- POSIX.1 program, _POSIX_SOURCE has to be defined before any of
- the POSIX.1 headers is #included.
-
- >Whatever flags one has to specify with 'cc' to get a posix compliant
- >program is implementaion defined or is there any posix specification on
- >that?
-
- This is outside the scope of POSIX.1. If your system supports
- POSIX.2, you can use the appropriate flags from that standard.
- Of course, that means you won't be calling your compiler 'cc'.
-
- Chuck Karish karish@mindcraft.com
- Mindcraft, Inc. 415 323 9000 x117
-
-
- Volume-Number: Volume 34, Number 16
-
-