arduino / arduino/ArduinoCore-API
Ambiguous timeout return value of `Stream::parseInt` and `Stream::parseFloat`
- Lingua principale
- C++
- Stelle
- 306
- Fork
- 150
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
### Describe the problem
The parsing functions of the `Stream` class have a timeout mechanism. If the operation does not complete prior to the expiration of the timeout, the functions return `0`:
`Stream::parseInt`:
https://github.com/arduino/ArduinoCore-API/blob/0f4e57ea193a00163ae59f0f0ff478feae7eb5db/api/Stream.cpp#L141
`Stream::parseFloat`:
https://github.com/arduino/ArduinoCore-API/blob/0f4e57ea193a00163ae59f0f0ff478feae7eb5db/api/Stream.cpp#L172
🐛 The function does not provide the user with an unambiguous indicator that the parsing failed.
### ArduinoCore-API version
Last verified with: 0f4e57ea193a00163ae59f0f0ff478feae7eb5db
### Additional context
I suggest that these functions be changed to return `(int)NAN` or `(float)NAN` on timeout.
#### Additional reports
- https://github.com/arduino/Arduino/issues/1796
- https://github.com/arduino/Arduino/issues/7177
#### Related
- https://github.com/arduino/ArduinoCore-API/issues/70
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia da Stream.cpp, nelle implementazioni di parseInt e parseFloat collegate nell’issue, quindi leggi l’issue correlata #70 e le segnalazioni aggiuntive di Arduino per il contesto di compatibilità. Confronta il comportamento del timeout con risultati validi pari a zero e definisci il completamento come un risultato di timeout non ambiguo per entrambe le funzioni di parsing, verificando il comportamento tra i chiamanti API pertinenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp
- Ambito
- api, embedded-iot
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100