Boost logo

Boost Users :

From: Chris Little (cslittle_at_[hidden])
Date: 2002-06-06 08:42:36

on 6/6/02 7:17 AM, John Maddock at john_maddock_at_[hidden] wrote:

>> I am trying to use the boost libraries with a PowerPlant project on the
>> MacOS, and I ran into a small incompatibility between the headers. I am
> not
>> sure which codebase is at fault here.
>> The issue is with the __MACH__ symbol. In the Boost code where it is
>> checking for what platform I am using, it correctly identifies my platform
>> as MacOS. Then, in a file called MacOS.hpp, it uses the __MACH__ symbol
> to
>> determine if I am using the BSD standard C libraries or MSL. (I am using
>> MSL.)
>> It does this by checking for the EXISTANCE of the __MACH__ symbol, not
>> the value of it:
>> // If __MACH__, we're using the BSD standard C library, not the MSL:
>> #if defined(__MACH__)
>> However, in the PowerPlant header PP_Macros.h, the __MACH__ symbol is
>> defined and set to zero:
>> #ifndef __dest_os // For MSL
>> #ifndef __MACH__
>> #define __MACH__ 0
>> #endif
>> #if __MACH__
>> #include <ansi_prefix.mach.h>
>> #else
>> #define __dest_os __mac_os
>> #endif
>> #endif
>> I was able to work around the problem for now by making the Boost
> libraries
>> check for both the existance of __MACH__ and the value:
>> #if defined(__MACH__) && __MACH__
>> Seems to work.
>> However, I am curious. Which way is the right way? Is the __MACH__
>> symbol's existance or its value supposed to signal whether or not it is
>> "turned on"? The boost headers seem to think it is its existance, but the
>> PowerPlant headers seem to think it is its value.
>> I want to report the problem, but I am not sure whose code needs to
> change,
>> PowerPlant or Boost. Ideas?
> Is PowerPlant a third party lib? If so then I don't think it should be
> setting a reserved symbol like __MACH__, however it's easy enough to change
> the boost code to verify that __MACH__ is greater than zero, so I'll make
> that change anyway unless there are objections (any Darwin experts out
> there?).
> John Maddock

PowerPlant is Metrowerks application framework for Mac OS. One of the
changes with Codewarrior 8 was the ability to use MSL or Apple's C library
when building mach-o targets.

Apple's native headers only check if __MACH__ is defined but they will only
be used when __MACH__ is simply defined or is 0 so the change in the
PowerPlant header file is benign if slightly unexpected.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at