struct stat.h with nanosecond resolution
Andi Kleen
ak@suse.de
Mon Dec 2 03:12:00 GMT 2002
On Mon, Dec 02, 2002 at 03:03:11AM -0800, Ulrich Drepper wrote:
> Andi Kleen wrote:
>
> > Just will it be assignment compatible then with struct timespec ?
>
> Of course. The typedef creates just another name for the same type.
But then you are not namespace clean no ?
If I understand it you want to do:
...
struct timespec {
...
};
typedef struct timespec __timespec_t;
...
Use __timespec_t in stat.h
That allows an user to later #define timespec to something else.
But it won't allow to redeclare timespec to a different type in the struct
namespace. It's some time since I did that namespace cleanliness thing, but
at least for ISO-C I'm pretty sure it not only included the preprocessor
name space, but also struct and typedef.
What would make more sense and being name space clean in all namespaces
when POSIX_SOURCE or XOPEN_SOURCE is defined is:
/* in extra header that gets included by sys/stat.h */
struct __timespec {
...
};
#if !_XOPEN_SOURCE && !_POSIX_SOURCE
struct timespec {
/* same */
};
#endif
sys/stat.h:
#if _XOPEN_SOURCE || _POSIX_SOURCE
struct __timespec ...; /* strict name space */
#else
struct timespec ...; /* easy compatibility */
#endif
-Andi
More information about the Libc-alpha
mailing list