Boost logo

Boost :

Subject: Re: [boost] What to do with platform defining 'null' as preprocessor symbol?
From: Jeff Flinn (Jeffrey.Flinn_at_[hidden])
Date: 2012-08-23 13:42:18


On 8/23/2012 12:59 PM, Stewart, Robert wrote:
> Jan Hudec wrote:
>>
>> At work we develop, among others, for Bada. The system
>> library provided is unfortunately somewhat flaky. A tell-tale
>> sign is, that it's native API headers define lowercase 'null'
>> as preprocessor symbol expanding to 0.
>
> Another one, huh? Did they learn that trick from Microsoft?

Apple's contributed more than there share with 'nil', 'check', ...

>> Unfortunately boost uses identifier 'null'.
> [snip]
>> Would it make sense to rename those identifiers and avoid
>> that name like boost avoids 'min' and 'max'?
>
> Boost doesn't avoid "min" and "max" but encloses them in parentheses to prevent preprocessor expansion. "null" could be treated similarly, though some may prefer to choose a different identifier. (At least there isn't an algorithm named "null"!)
>
> You'll need to find all the places where "null" occurs and file Trac tickets to get things fixed. If you supply patches against trunk, they are more likely to be applied.
>
> If you can apply the patches and run the tests yourself against several compilers on different platforms, you could send a summary reply to this thread with the Trac issues and the results of your testing. Then, someone might even submit all of your patches in one go.

Might it not be better to provide some platform specific config file(s)
that undef offending macro names. In the case of nil in fusion, I'd hate
to see a loss in clarity because of some bad platform practice. I've
been able to address these issues by #undef'ing in just a few places.

Jeff


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