From: Martin Wille (mw8329_at_[hidden])
Date: 2004-09-30 06:05:41
Beman Dawes wrote:
> At 02:51 AM 9/21/2004, Martin Wille wrote:
> >There are two problems:
> >1. POSIX feature flags get set *after* the first #include of
> >a POSIX header. This likely will confuse the POSIX feature flag
> >system. This probably also explains why the code later #defines
> >flags internally used by that system.
> >2. The feature flag system special-cases gcc. This makes
> >things rather ugly for us because the type returned by
> >readdir() changes with the compiler: dirent * for gcc,
> >dirent64 * for icc. Those types, however, have the same
> >layout if 64 bit support was enabled by #defining
> >_FILE_OFFSET_BITS to 64 before #including a POSIX header.
> I'm not sure that analysis is correct since (1) it is only affecting one
> particular version of one compiler, rather than all POSIX compilers, and
It could simply be luck that the code works correctly
on other systems. However, it seems the 64 bit flags
are not defined by POSIX. Nevertheless, the feature
selection of glibc behaves similar to the POSIX rules,
according to <features.h>
> (2) other than some Boost headers, which presumably don't include POSIX
> headers, the define is give before inclusion other headers.
Boost.Config #includes <unistd.h>, if I recall correctly.
So, basically every Boost header does #include POSIX
IEEE Std 1003.1-2001 says:
"In the compilation of an application that #defines a feature test macro
specified by IEEE Std 1003.1-2001, no header defined by IEEE Std
1003.1-2001 shall be included prior to the definition of the feature
test macro. This restriction also applies to any implementation-provided
header in which these feature test macros are used. If the definition of
the macro does not precede the #include, the result is undefined."
> It any case, please try moving the define to the first line of the file,
> and let me know if that changes the results.
No, that doesn't work. I described the symptoms
under point 2 in my former posting.
I guess we could try to use dirent64 instead of the
dirent type for icc.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk