Boost logo

Boost :

Subject: Re: [boost] Ticket #2115 Avoid bad Apple macros
From: Mat Marcus (mat-lists_at_[hidden])
Date: 2008-10-13 14:08:41


On Mon, Oct 13, 2008 at 1:40 AM, John Maddock <john_at_[hidden]> wrote:
> Mat Marcus wrote:
>>>
>>> On Sun, Oct 12, 2008 at 1:54 PM, Beman Dawes <bdawes_at_[hidden]> wrote:
>>>>
>>>> On Sun, Oct 12, 2008 at 2:30 PM, Mat Marcus <mat-lists_at_[hidden]>
>>>> wrote: ...
>>>>
>>>>> So, please put pressure on Apple, and file the necessary bug
>>>>> reports. But each requirement that a library imposes loses a group
>>>>> of users. But please also consider "fixing" boost too.
>>>>
>>>>
>>>> I still haven't seen a concrete proposal as to exactly what a fix
>>>> would be.
>>>
>>> Sadly, I don't know of a better fix than the one you mentioned at the
>>> beginning of this thread--namely, that boost avoid using the names
>>> that vendors steal with macros in commonly included headers. I didn't
>>> like having to rename functions named check() in our code, but my
>>> users like it even less when things didn't work for them. (This was
>>> some time ago...I didn't look at the original bug report, and I don't
>>> know how many Apple headers still pull the offending header in
>>> indirectly).
>
> Are the Apple defined macros function-like macros? If so we could use the
> usual macro-expansion suppression in these cases as we do with min/max.
>
> John.

Yes, at least check is function-like:

  #define check(assertion) \
      do \
      { \
          if ( __builtin_expect(!(assertion), 0) ) \
          { \
              DEBUG_ASSERT_MESSAGE( \
                  DEBUG_ASSERT_COMPONENT_NAME_STRING, \
                  #assertion, \
                  0, \
                  0, \
                  __FILE__, \
                  __LINE__, \
                  0); \
          } \
      } while ( 0 )


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