home *** CD-ROM | disk | FTP | other *** search
- From: dmr@research.att.com (Dennis Ritchie)
-
- I wish Gwyn et. al had sounded a bit more embarrassed about using
- `char d_name[1]' in struct dirent. Tanenbaum is absolutely correct to
- question it; it is an abuse of the language and would not pass a
- compiler system with careful run-time checks. From the language point
- of view, there is no reason at all to forbid declaring an instance of
- struct dirent, or copying the value pointed to by the value of readdir().
- Gwyn's definition implies incorrect C. (Well, the definition
- is well-defined, but not the expectation that there is more than 1 character
- actually in the d_name array).
-
- There is no such type as char[], and `char d_name[]' may not appear
- in a structure, and if the declaration is `char d_name[1]' then
- you may not refer to d_name[i] when i>1.
-
- I don't have the POSIX wording at hand, but if it forbids
- `struct dirent d = *readdir(dp)' then it is flaky.
-
- Dennis Ritchie
- dmr@research.att.com
- att!research!dmr
-
- Volume-Number: Volume 17, Number 76
-
-
-