
Beman Dawes wrote:
The directory iterator value type objects now caches status information. Performance is much better (6 times, in one test).
This optimization is present for the Windows API, and for POSIX systems which support the BSD dirent::d_type extension. Currently this is detected by the __USE_BSD macro. Please report other macros which indicate it is safe to turn on this feature.
IIRC, someone indicated that Linux also supports the feature, but perhaps only on later versions. If that is the case, what is the correct macros to be tested for what values?
Also, Apple OS X supplies the dirent::d_type extension, but the value isn't actually set. Any ideas on how to activate it?
--Beman
PS: If you want to experiment, the #if test to hack is line 65 of .../boost/filesystem/config.hpp, current CVS head.
You'd be using readdir, then? Well man readdir says: According to POSIX, the dirent structure contains a field char d_name[] of unspecified size, with at most NAME_MAX characters preceding the terminating null character. Use of other fields will harm the porta- bility of your programs. POSIX 1003.1-2001 also documents the field ino_t d_ino as an XSI extension. OTOH, the glibc header dirent.h says: /* This file defines `struct dirent'. It defines the macro `_DIRENT_HAVE_D_NAMLEN' iff there is a `d_namlen' member that gives the length of `d_name'. It defines the macro `_DIRENT_HAVE_D_RECLEN' iff there is a `d_reclen' member that gives the size of the entire directory entry. It defines the macro `_DIRENT_HAVE_D_OFF' iff there is a `d_off' member that gives the file offset of the next directory entry. It defines the macro `_DIRENT_HAVE_D_TYPE' iff there is a `d_type' member that gives the type of the file. */