arduino / arduino/ArduinoCore-API

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

Abierto
#239 1 comentario 0 reacciones 0 asignados Ver en GitHub
bug
Lenguaje dominante
C++
Estrellas
306
Forks
150
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Busca en la implementación de String de ArduinoCore-API las declaraciones y las implementaciones de indexOf() y lastIndexOf(), y compara después sus tipos de retorno con len, charAt(), substring(), remove() y reserve(). Verifica que ambos métodos usen de forma coherente el tipo unsigned previsto y que los llamadores que pasan sus resultados a substring() ya no necesiten un cast.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
cpp
Área
api, embedded-iot
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
52/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.