Boost logo

Boost :

From: Darin Adler (darin_at_[hidden])
Date: 2001-12-19 21:06:26


On 12/19/01 4:21 PM, "Daryle Walker" <darylew_at_[hidden]> wrote:

> [The non-conformance is about Apple using "nil" as a macro in their Mac OS
> system headers. Some members of Boost wish that "nil" was available so they
> can name default types with it instead of "null_type."]
>
> You shouldn't call this non-conforming. The word "nil" isn't mentioned in
> the C++ standard. We have no higher right to use it than anyone else. It
> may be annoying, but Apple doesn't have to have any mandate to get rid of
> it.

That's true, and I had considered posting a note to that effect. But it
would be non-conforming if including any of the C or C++ standard headers
caused the "nil" macro to be defined.

On the other hand, it's conventionally considered bad form for C or C++
header files to define macros that are not all capital letters, and it's too
bad that Apple's <MacTypes.h> has one (actually two in recent versions,
because of the surprising recent addition of a kInvalidID macro that expands
to 0).

But as far as I'm concerned, there's no need for a BOOST_MPL_NIL workaround,
though, because adding:

    #include <MacTypes.h>
    #undef nil
    #define nil nil

to the start of any source file where this is a problem should do just fine
as a workaround.

    -- Darin


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