Boost logo

Boost :

From: John Maddock (jm_at_[hidden])
Date: 2003-02-09 07:02:18

> > How about:
> >
> > #if defined(_POSIX_C_SOURCE) && defined(_POSIX_VERSION) &&
> > (_POSIX_VERSION >= 199506L) && !defined(_WIN32)
> >
> > which should be about right if I've understood the standard correctly.
> IMO there are several issues with above check. If you would take a look
> %20gcc
> you will see that
> a. _POSIX_C_SOURCE is not defined

It's probably being overly picky requiring that one to be defined, strictly
speaking you can't use any POSIX API's unless _POSIX_C_SOURCE has been
defined before the inclusion of any std header - most platforms don't seem
to care though.

> b. _POSIX_VERSION is smaller

Particular platforms may have sigaction support even though they only claim
conformance to an earlier version of the POSIX standard - cygwin is one -
check for __CYGWIN__.

> P.S. Also let me revisit my other related question: would it be ok on all
> compatible platforms to use csignal instead of signal.h?

No, sigaction and friends aren't part of the C++ or C standards: you need to
include <signal.h> to get the full unix definitions, not just those required
by C++.

John Maddock

Boost list run by bdawes at, gregod at, cpdaniel at, john at