Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-07-16 06:54:08


Vladimir Prus <ghost_at_[hidden]> writes:

> Hello,
> in my library I use _WIN32 macro to detect the case when I'm on windows (e.g.
> to get the right header for 'environ'). However, Boost.Config has more
> complex logic:
>
> #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
> // win32:
> ....
>
> Does it mean I have to use the same conditional? Which compilers define
> __WIN32__ or WIN32, but don't define _WIN32? Shouldn't there be a single
> BOOST_WINDOWS macros to help in this cases?

Yes and yes, IMO.

> FWIW, filesystem defines such macro internally:
>
> # if !defined( BOOST_WINDOWS ) && !defined( BOOST_POSIX )
> # if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
> || defined(__CYGWIN__)
> # define BOOST_WINDOWS
> # else
> # define BOOST_POSIX
> # endif
> # endif

...which is strange because Cygwin is a Posix platform.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

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