Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2003-02-09 03:24:53


Hi,

Some time ago there was a discussion on how properly identify "unix" for
selecting proper signal handling algorithm. Here is fragment of John
Maddok's letter:

> ... currently you have:
>
> // for testing on Win32, GCC thinks it is a unix platform
> // TODO: figure out how to tell it is really unix
> #elif defined(__unix) && !defined(__GNUC__)
>
> There are several things wrong with this:
>
> __unix need not be defined on POSIX conforming systems
> __unix may be defined on systems that don't support sigaction etc.
> almost all version of __GNUC__ do have sigaction support including
> cygwin.
>
> 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 here
http://boost.sourceforge.net/regression-logs/cs-win32-links.html#config_info
%20gcc

you will see that

a. _POSIX_C_SOURCE is not defined
b. _POSIX_VERSION is smaller

Nevertheless, I was able to check that this version of gcc perfectly compile
and work with unix style signal handling.
Accordingly here is the question: how properly identify the "unix" style
signal handling?

Gennadiy.

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?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk