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

  1. From: Andy Tanenbaum <uunet!cs.vu.nl!ast>
  2.  
  3. In article <438@longway.TIC.COM> gwyn@brl.arpa (Doug Gwyn) writes:
  4.  
  5. >You, the implementer, could manually replace that NAME_MAX with the
  6. >appropriate value (perhaps found by inspecting <limits.h>). 
  7.  
  8. It is true I could just put 14 there, or #define it to be _NAME_MAX in that
  9. file, but that seems poor programming practice.  If that constant ever gets
  10. changed in <limits.h> but not in <dirent.h> disaster will strike.
  11.  
  12. >What I did in my implementation was to cheat:
  13. >    char    d_name[1];
  14.  
  15. What happens when a program allocates a struct dirent in a program?  The
  16. compiler will not allocate enough storage and it will crash when used.
  17.  
  18. Is it legal to add a line
  19.  
  20. #include <limits.h> 
  21.  
  22. in <dirent.h>?
  23.  
  24. Andy Tanenbaum (ast@cs.vu.nl)
  25.  
  26. Volume-Number: Volume 17, Number 69
  27.  
  28.  
  29.