In message <[email protected]> on Sun, 19 Jul 2015 04:09:33 +0100, Aaron Sloman <[email protected]> said:
A.Sloman> i.e. A.Sloman> > + # define __USE_POSIX A.Sloman> A.Sloman> instead of A.Sloman> > +# define _POSIX_C_SOURCE 1 Nope. A google on "_POSIX_C_SOURCE vs __USE_POSIX" quickly leads to this: http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html And if you have a look at /usr/include/features.h, which is the header files that controls what happens, you'll see a fairly large comment listing the available feature macros, quickly followed by a series of #undef, among others this: #undef __USE_POSIX So you see, defining __USE_POSIX in util.c does exactly nothing. So, defining _POSIX_C_SOURCE is quite correct. However, because features.h is include *much* earlier, you have to define it much higher up. See attached patch. Cheers, Richard -- Richard Levitte [email protected] http://richard.levitte.org/ "Life is a tremendous celebration - and I'm invited!" -- from a friend's blog, translated from Swedish
=== modified file 'util.c' --- util.c 2015-07-18 20:24:10 +0000 +++ util.c 2015-07-19 08:50:16 +0000 @@ -75,6 +75,7 @@ ***********************************************************************/ #define LEVITTE_TEST +#define _POSIX_C_SOURCE 1 #include <stdio.h> #include <string.h>
