BOOST_PP_REMOVE_PARENS() is dangerously broken -- it strips initial group of parentheses instead of surrounding
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 38/100
Research direction
Start with the Godbolt reproducer and boost/preprocessor/punctuation/remove_parens.hpp to verify how BOOST_PP_REMOVE_PARENS handles the input. Review the documented contract and determine the intended API change, including compatibility and naming implications. Done means the behavior and documentation agree with an explicitly decided contract, with the reproducer no longer exposing the reported pitfall.
Written by the indexing model from the issue text.
Description
https://godbolt.org/z/38jbTP7qn
#include <boost/preprocessor/punctuation/remove_parens.hpp>
int main(int argc, char *argv[]) {
#if MACRO
return BOOST_PP_REMOVE_PARENS((*argv)[1]); // Crash
#else
return (*argv)[1] ; // OK
#endif
}
Note the documentation piles extra confusion on top of this. It says:
The
BOOST_PP_REMOVE_PARENSmacro removes the beginning parenthesis, if it exists, from the input data and expands to the result
"Parenthesis" is singular (plural is parentheses), so the documentation is claiming that only a beginning ( is being removed. It makes no mention of removing any closing ), regardless of its expected location, even though the function apparently does that regardless of its location.
This is a massive pitfall. The name BOOST_PP_REMOVE_PARENS itself (and the intended usage) are misleading for most users and very unlikely to be what they actually want.
I would suggest, at the very least, renaming the macro to something like BOOST_PP_REMOVE_BEGINNING_PARENS and updating the documentation to clarify it is not doing what users would expect from a REMOVE_PARENS macro.
- Dominant language
- C++
- Stars
- 118
- Forks
- 76
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/preprocessor
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
boostorg/preprocessor#63 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 58/100
boostorg/preprocessor#58 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
boostorg/preprocessor#55 ·
-
Documentation format Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
boostorg/preprocessor#52 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
boostorg/preprocessor#50 · 1 comment ·
All issues in boostorg/preprocessor
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·