BOOST_PP_REMOVE_PARENS() is dangerously broken -- it strips initial group of parentheses instead of surrounding
まだ誰も着手していません。
評価
調査の方向性
Godbolt の再現コードと boost/preprocessor/punctuation/remove_parens.hpp から始めて、BOOST_PP_REMOVE_PARENS が入力をどのように処理するかを確認します。文書化された契約を見直し、互換性と命名への影響を含め、意図する API 変更を決定します。明示的に決定された契約に動作とドキュメントが一致し、再現コードで報告された問題点がもはや露呈しなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- C++
- スター
- 118
- フォーク
- 76
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
boostorg/preprocessor のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
boostorg/preprocessor#63 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 58/100
boostorg/preprocessor#58 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 55/100
boostorg/preprocessor#55 ·
-
Documentation format オープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
boostorg/preprocessor#52 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
boostorg/preprocessor#50 · コメント 1 件 ·
boostorg/preprocessor の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
AXERA-TECH/ax-llm#77 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
games-on-whales/wolf#509 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
bug-unconfirmed
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
NVIDIA/cuda-samples#453 ·