arduino / arduino/ArduinoCore-API
String relational operators are members.
- 主要言語
- C++
- スター
- 306
- フォーク
- 150
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Member relational operators are no good because they cause the lhs and rhs to be treated differently. This causes problems such as making == appear non-commutative. Such as:
```c++
void setup() {
String("hi") == "world";
"world" == String("hi");
}
```
```
sketch_jan19a:3: error: no match for 'operator==' (operand types are 'const char [6]' and 'String')
"world" == String("hi");
^
exit status 1
```
It would be less user-surprising to bring these operators out of the class.
I propose defining them at namespace scope as symmetric pairs of operators, between a String on one side, and everything String accepts as an implicit conversion on the other side, per:
http://en.cppreference.com/w/cpp/string/basic_string/operator_cmp
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Issue にある 2 つの C++ 式を最初の再現として使用し、次に ArduinoCore-API 内の String の関係演算子宣言を見つけます。両方のオペランド順を比較し、既存の String の動作を確認します。完了の条件は、同等の比較がコンパイル可能で対称的に動作し、報告されたケースを対象とするカバレッジがあることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- cpp
- 領域
- api, embedded-iot
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100