home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.17 / text0066.txt < prev    next >
Encoding:
Internet Message Format  |  1990-01-06  |  1.5 KB

  1. From: karish@forel.stanford.edu (Chuck Karish)
  2.  
  3. In article <442@longway.TIC.COM> gwyn@brl.arpa (Doug Gwyn) wrote:
  4. >In article <441@longway.TIC.COM> Andy Tanenbaum <uunet!cs.vu.nl!ast> writes:
  5. >->    char    d_name[1];
  6. >-What happens when a program allocates a struct dirent in a program?  The
  7. >-compiler will not allocate enough storage and it will crash when used.
  8. >
  9. >That's what happens when programmers assume things that are not promised
  10. >by the standards.
  11.  
  12. This is spelled out in the rationale (B.5.1.1).
  13.  
  14. >-Is it legal to add a line
  15. >-#include <limits.h> 
  16. >-in <dirent.h>?
  17. >
  18. >NO.
  19.  
  20. A citation would be more useful here than this proclamation.
  21.  
  22. I haven't been able to find anything in the 1003.1 documents that would
  23. prohibit this.
  24.  
  25. The form of a header is defined by the implementation.  There are many
  26. places in the Standard where it is required that a particular
  27. identifier be available when a particular header is #included, but I
  28. haven't found any that require that identifiers not be visible when the
  29. headers to which they are assigned have not been #included.
  30.  
  31. Portable application code must #include headers as listed in the
  32. function descriptions in the standard, if only for compatibility
  33. with implementations that don't support ANSI C.  It will be easier
  34. to identify non-portable code under implementations that refrain from
  35. #including, for example, <sys/types.h> in <stat.h>.
  36.  
  37.     Chuck Karish        karish@mindcraft.com
  38.     (415) 323-9000        karish@forel.stanford.edu
  39.  
  40. Volume-Number: Volume 17, Number 75
  41.  
  42.  
  43.