arduino / arduino/ArduinoCore-API

String object, len is of type unsigned int, however indexOf() and lastIndexOf() return int

オープン
#239 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug
主要言語
C++
スター
306
フォーク
150
PR マージ指標
30日以内にマージされた PR はありません

説明

### Description

String Object:

len is of type unsigned int.
method that apply to position into the String or its size are expecting an unsigned int, this is the case with:
charAt()
substring()
remove()
reserve()

Oddly, indexOf() and lastIndexOf() are returning int and not unsigned int

### Current behavior

Oddly, indexOf() and lastIndexOf() are returning int and not unsigned int

### Expected behavior

indexOf() and lastIndexOf() ought to return unsigned int, to avoid unnecessary casting from int to unsigned int

### Additional information
It's frequent to pass the result of indexOf() to substring()

Thanks

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

ArduinoCore-API の String 実装で indexOf() と lastIndexOf() の宣言および実装を検索し、それらの戻り値の型を len、charAt()、substring()、remove()、reserve() と比較します。両方のメソッドが意図された unsigned 型を一貫して使用していること、また結果を substring() に渡す呼び出し側でキャストが不要になっていることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp
領域
api, embedded-iot
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
52/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。