boostorg / boostorg/boost

Removal of global placeholders causes multiple software to fail even when BOOST_BIND_GLOBAL_PLACEHOLDERS is set

Open
#458 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
8.6k
Forks
1.9k
Avg merge
39m
Merged PRs (30d)
2

Description

Multiple software suffered from boost global placeholders removal causing "_1 was not declared in this scope" like compiler errors. The backward compatibility was supposed to be addressed by BOOST_BIND_GLOBAL_PLACEHOLDERS, it looked like you define BOOST_BIND_GLOBAL_PLACEHOLDERS and then magically bind.hpp header is pulled in everything boost uses returning the old logic back.

But that macros is just a plug that does nothing but:

#if !defined(BOOST_BIND_GLOBAL_PLACEHOLDERS)

BOOST_PRAGMA_MESSAGE(
"The practice of declaring the Bind placeholders (_1, _2, ...) "
"in the global namespace is deprecated. Please use "
" + using namespace boost::placeholders, "
"or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior."
)

#endif

defining or not defining it just affects the message, but not the logic.

When BOOST_BIND_GLOBAL_PLACEHOLDERS is defined the old logic of registering global placeholders should be back with everything using any boost header for at least 2-3 next years when all the developers patch their software.

Pulling _1 in the global scope might be the bad practice but that practice was set by boost and used widely by many developers

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how boost/bind/bind.hpp and bind.hpp handle BOOST_BIND_GLOBAL_PLACEHOLDERS, then compare the macro's documented compatibility behavior with the current placeholder declarations. Done means defining the macro restores global _1, _2 and related placeholders for code including Boost headers, while leaving the deprecation message behavior unchanged when it is not defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.