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

  1. From: dmr@research.att.com (Dennis Ritchie)
  2.  
  3. I wish Gwyn et. al had sounded a bit more embarrassed about using
  4. `char d_name[1]' in struct dirent.  Tanenbaum is absolutely correct to
  5. question it; it is an abuse of the language and would not pass a
  6. compiler system with careful run-time checks.  From the language point
  7. of view, there is no reason at all to forbid declaring an instance of
  8. struct dirent, or copying the value pointed to by the value of readdir().
  9. Gwyn's definition implies incorrect C.   (Well, the definition
  10. is well-defined, but not the expectation that there is more than 1 character
  11. actually in the d_name array).
  12.  
  13. There is no such type as char[], and `char d_name[]' may not appear
  14. in a structure, and if the declaration is `char d_name[1]' then
  15. you may not refer to d_name[i] when i>1.
  16.  
  17. I don't have the POSIX wording at hand, but if it forbids
  18. `struct dirent d = *readdir(dp)' then it is flaky.
  19.  
  20.     Dennis Ritchie
  21.     dmr@research.att.com
  22.     att!research!dmr
  23.  
  24. Volume-Number: Volume 17, Number 76
  25.  
  26.  
  27.