[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#314435: libc6-dev: struct timespec and nanosleep() not available with -std=c99

Hello Lars and Daniel,

thanks much for the links and explanations!

On Thu, Jun 16, 2005 at 01:37:34PM +0300, Lars Wirzenius wrote:
> The C standard guarantees (see page 166, 7.1.3, "Reserved identifiers",
> if you have a copy) that the standard headers do not define identifiers
> that the C standard does not explicitly declare as defined by the
> standard, reserved for future versions of the standard, or reserved to
> the implementation. "struct timespec" and "nanosleep" are not such
> identifiers.

Indeed. I've overseen that time.h is also defined by C99. I've changed
my opinion regarding whether this is a libc6-dev bug.

However, I still have a problem. My intention is to use -std=c99 and
define macros like _BSD_SOURCE in order to document all portability
issues at the top of the files. After I defined _POSIX_C_SOURCE to
200201L, I'm able to compile the file without problems. However, neither
SUSv3, nor Linux man page say anything about it. That is why I used to
think that struct timespec and nanosleep MUST be available after a bare
#include <time.h>. Does POSIX specify whether the availability can be
controlled with a macro? Should Linux man page be updated to mention

BTW, defining _POSIX_SOURCE, which is described in the glibc
documentation, didn't work for me. Is it a bug, or does "POSIX.1" mean
POSIX 1990 only?

With kind regards,

Reply to: