From: Prof B. R. <ri...@st...> - 2011-10-25 06:51:38
|
I first noticed this in Ruben's 4.6.2 build, but the trunk has a similar problem (if the winpthead library is installed). time.h ends #ifdef __cplusplus } #endif #pragma pack(pop) #include <sec_api/time_s.h> /* Adding timespec definition. */ #include <sys/timeb.h> #include <pthread_time.h> The problem is that as a result time.h includes pthread.h which includes signal.h and other headers. My immediate problem was that I was including time.h in an alternative signal handler and so had a ton of conflicts. And this namespace pollution is a really bad idea in general. POSIX 2008 says clock_gettime and timespec are in time.h, but other systems (Linux, Solaris) tend to declare such recent-ish additions only if some guard is raised, e.g. if _POSIX_C_SOURCE is set to a high enough value. So if it not possible to remove the dependence on pthread.h, can it at least be included conditionally? A less important issue is that pthread_time.h is not included inside extern "C" {} and AFAICS does not protect e.g. clock_gettime from C++ name-mangling. Brian Ripley -- Brian D. Ripley, ri...@st... Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 |