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

Re: Best test condition for defining _GNU_SOURCE?



Svante Signell, le Thu 14 Jun 2012 09:46:14 +0200, a écrit :
> Is the following construct OK?
> #ifdef __GNUC__
> #define _GNU_SOURCE
> #endif

GNU C does not necessarily imply using the GLIBC. Defining _GNU_SOURCE
all the time shouldn't hurt, however, so simply drop the #ifdef.

> ...
> #include <unistd.h>
> ...
> #ifdef __GLIBC__
>  new_path = get_current_dir_name();
> ...
> #endif

Samuel


Reply to: