[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sys/time.h: no more -ansi timercmp ?
From: |
Andreas Jaeger |
Subject: |
Re: sys/time.h: no more -ansi timercmp ? |
Date: |
26 Jun 2001 09:23:16 +0200 |
User-agent: |
Gnus/5.090004 (Oort Gnus v0.04) XEmacs/21.1 (Cuyahoga Valley) |
address@hidden writes:
> From: David Morse <address@hidden>
>
> Andreas Jaeger <address@hidden> wrote:
>
> > Add the appropriate feature test macros (details are in the libc
> > manual), e.g. _BSD_SOURCE.
>
> Ok, read the entry in the manual. Is the cpp symbol _BSD_SOURCE itself a
> gnu extension, or part of some portable standard? I.e. which of these is
> correct:
>
> #ifndef _BSD_SOURCE
> #define _BSD_SOURCE
> #include <sys/time.h>
> #undef _BSD_SOURCE
> #else
> #include <sys/time.h>
> #endif
>
> or
>
> #ifdef *GLIBC*
That won't work - you need to define _BSD_SOURCE etc before the
inclusion of any other header file!
> #ifndef _BSD_SOURCE
> #define _BSD_SOURCE
> #include <sys/time.h>
> #undef _BSD_SOURCE
> #else
> #include <sys/time.h>
> #endif
> #else
> #include <sys/time.h>
> #endif
>
> where *GLIBC* is some CPP symbol that I don't know yet, that that tells if
> using glibc.
The right way is:
#define _BSD_SOURCE
#include <...>
>
> Andreas Jaeger will give the right answer. Let me give the
> wrong one.
I'm not sure if my answer is right and your's wrong - but let's give
it a try ;-).
Some of those _*SOURCE macros are required by the appropriate
standards, like _POSIX_C_SOURCE and _XOPEN_SOURCE. Others (I'm not
sure) might be a logical GNU extension. It doesn't hurd to use them.
Andreas
--
Andreas Jaeger
SuSE Labs address@hidden
private address@hidden
http://www.suse.de/~aj