home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / std_unix / archive / text0016.txt < prev    next >
Encoding:
Text File  |  1994-03-07  |  1.4 KB  |  41 lines

  1. Submitted-by: karish@mindcraft.com (Chuck Karish)
  2.  
  3. srini@hpcuhe.cup.hp.com (Sreenivasa Rao Tellakula) wrote:
  4. >If I have two prototypes for the same function, one is posix version
  5. >and one is non-posix and if I have to put them in the header file, what
  6. >ifdef I have to use? Can I use _POSIX_SOURCE?
  7.  
  8. Yes, assuming that the first "int *" in the second prototype is
  9. a typographical error that will be corrected.  This is a perfectly
  10. appropriate use for _POSIX_SOURCE.
  11.  
  12. The #ifdef is not needed if gid_t is an int on your system.  The
  13. definition could be expressed just as
  14.  
  15.      extern int getgroups (int, int *);
  16.  
  17. See POSIX.1-1990, page 33, lines 940-946.
  18.  
  19. >If correct, this means all posix programs
  20. >needs to be compiled with cc -D_POSIX_SOURCE and is this an acceptable
  21. >constraint?
  22.  
  23. This is not only acceptable, it is required.  When compiling a
  24. POSIX.1 program, _POSIX_SOURCE has to be defined before any of
  25. the POSIX.1 headers is #included.
  26.  
  27. >Whatever flags one has to specify with 'cc' to get a posix compliant
  28. >program is implementaion defined or is there any posix specification on
  29. >that?
  30.  
  31. This is outside the scope of POSIX.1.  If your system supports
  32. POSIX.2, you can use the appropriate flags from that standard.
  33. Of course, that means you won't be calling your compiler 'cc'.
  34.  
  35.     Chuck Karish        karish@mindcraft.com
  36.     Mindcraft, Inc.     415 323 9000 x117
  37.  
  38.  
  39. Volume-Number: Volume 34, Number 16
  40.  
  41.