Skip to content

Why does it expand to BOOST_VERSION_NUMBER_AVAILABLE? #128

@vinipsmaker

Description

@vinipsmaker

Boost.Predef macros (e.g. BOOST_OS_WINDOWS) expand to BOOST_VERSION_NUMBER_AVAILABLE instead of 1 or 0. Why is that?

By expanding to BOOST_VERSION_NUMBER_AVAILABLE I can't use these macros in Boost.PP. For instance, I recently had to use code like:

BOOST_PP_IF(
    BOOST_OS_UNIX,
    lua_pushcfunction(L, tcp_socket_assign),
    lua_pushcfunction(L, throw_enosys));

But it failed to compile because BOOST_OS_UNIX doesn't expand to 1 or 0. Instead, it expands to a complex expression that can't be used in preprocessor metaprogramming.

Could we offer BOOST_OS_UNIX10 (and the equivalent to other macros as well) that expand to 1 or 0 instead of a complex expression? Or, alternatively, modify these macros to expand to 1 or 0 already?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions