boostorg / boostorg/predef

Why does it expand to BOOST_VERSION_NUMBER_AVAILABLE?

Open
#128 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
56
Forks
87
PR merge metrics
No merged PRs in 30d

Description

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:

```c
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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.