This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: struct stat.h with nanosecond resolution


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]