arduino / arduino/ArduinoCore-API

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

Đang mở
#239 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
C++
Star
306
Fork
150
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### 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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Tìm trong phần triển khai String của ArduinoCore-API các khai báo và phần triển khai của indexOf() và lastIndexOf(), sau đó so sánh kiểu trả về của chúng với len, charAt(), substring(), remove() và reserve(). Xác minh rằng cả hai phương thức đều nhất quán sử dụng kiểu unsigned được dự định và rằng các bên gọi truyền kết quả của chúng vào substring() không còn cần một cast.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
cpp
Lĩnh vực
api, embedded-iot
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
52/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.