arduino / arduino/ArduinoCore-avr
ReadBytesUntil should be able to return empty if a terminator is detected without data
- Dominant language
- C
- Stars
- 1.5k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
Just some feedback and an open question of a possible redesign of ReadBytesUntil functions.
ReadBytesUntil should have a return state that means "we detected your terminator character but there were no data".
I don't think it should be the user to peek at this since the name of the method implicitly suggest it does that and it was just not in mind in the first place.
ReadBytesUntil, it is where things can be more dangerous. I would go with returning 0 meaning the terminator has been found but there was no data and "-1" (maximum of _size_t_) means the terminator has not been found.
However, doing so will be a breaking change.
Disclaimer: I'm not a heavy user of Arduino, so I don't know your actual restriction, limitations, overall users history with breaking changes, ...
Such discussion should affect ticket #290 in someway (don't just read the title)
NOTE: There is ReadStringUntil that technically do the job already.
Labels suggestion:
- enhancement
- question
- waiting for feedback
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the ReadBytesUntil and ReadStringUntil entry points, then read the discussion in issue #290. Clarify the proposed return-state contract and its compatibility impact before identifying the tests needed to distinguish an empty terminator result from a missing terminator.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100