RE: [boost] [config] _WIN32 question

Hi Volodya,
From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Vladimir Prus
[snip]
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?
The macro _WIN32 was originally hard-coded into the Microsoft compiler to recognize the platform. The other vendors took it the same way, but maybe because of rapid development in the early ages there are more underscored versions available... Here we are macros *32*, as they are defined: Borland: __WIN32__ _WIN32 Digital Mars: _WIN32 GCC (MinG/W and Cygwin with -mno-cygwin): __MINGW32__ WIN32 _WIN32 __WIN32 __WIN32__ Metrowerks: _WIN32 Microsoft: _WIN32 The macro WIN32 is meant to be a user-definable option how to enforce a WIN32 code if a compiler does not define _WIN32. Cygwin platform in POSIX mode is not a WIN32-compatible platform (no headers, no libraries), and thus their macros should mark a POSIX code, not Windows: GCC (Cygwin in POSIX mode): __CYGWIN__ __CYGWIN32__
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
I like the single BOOST_XXX macro idea for all libraries, I would only delete __CYGWIN__, which defines POSIX compatibility. And if you like, it is possible to do something like this to be complete: BOOST_WIN32 : _WIN32 || WIN32 BOOST_WIN64 : _WIN64| WIN64 BOOST_WINDOWS : BOOST_WIN32 || BOOST_WIN64 Ferda
- Volodya

Hi Ferdinand,
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?
The macro _WIN32 was originally hard-coded into the Microsoft compiler to recognize the platform. The other vendors took it the same way, but maybe because of rapid development in the early ages there are more underscored versions available... Here we are macros *32*, as they are defined:
Borland: __WIN32__ _WIN32 Digital Mars: _WIN32 GCC (MinG/W and Cygwin with -mno-cygwin): __MINGW32__ WIN32 _WIN32 __WIN32 __WIN32__ Metrowerks: _WIN32 Microsoft: _WIN32
It seems that _WIN32 is defined by all of them....
The macro WIN32 is meant to be a user-definable option how to enforce a WIN32 code if a compiler does not define _WIN32.
Ok. When is it needed, BTW?
Cygwin platform in POSIX mode is not a WIN32-compatible platform (no headers, no libraries), and thus their macros should mark a POSIX code, not Windows:
GCC (Cygwin in POSIX mode): __CYGWIN__ __CYGWIN32__
Ok.
# endif
I like the single BOOST_XXX macro idea for all libraries, I would only delete __CYGWIN__, which defines POSIX compatibility.
Ok.
And if you like, it is possible to do something like this to be complete:
BOOST_WIN32 : _WIN32 || WIN32 BOOST_WIN64 : _WIN64| WIN64 BOOST_WINDOWS : BOOST_WIN32 || BOOST_WIN64
Yea, I think this makes sense. Though _WIN64 is not used anywhere in config yet. - Volodya
participants (2)
-
Ferdinand Prantl
-
Vladimir Prus