Clean up use of sprintf
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 28/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- api, embedded-iot
Research direction
Locate the String and IPAddress API implementations and the test suite's itoa and dtostrf helpers. Read the existing sprintf pragmas and conversion paths first. Done means removing the suppressions and addressing the identified deprecated sprintf uses without breaking String, IPAddress, or String tests.
Written by the indexing model from the issue text.
Description
In #208 I added pragmas to suppress deprecation warnings related to sprintf that were added in newer versions of GCC and CLang, and which caused compilation failure. These suppressions should be removed.
One usage is in the test suite's implemention of itoa that is needed to run String tests. I have a quick fix for that relying on snprintf but I also thought of just using a more basic implementation of itoa such as the one from K&R or even just copying the implementation from the SAMD core.
Thinking a bit deeper though, the only use in API code is in String and it looks to be unnecessarily double buffering during those conversions. I think there's an opportunity to remove String's dependency on itoa and make it more efficient, which would also eliminate the need for an implementation of itoa in the test suite. I plan to look in to that approach.
A similar use is in the test suite's implementation of dtostrf which delegates the deprecated avr impl. For that, I think String can be improved to avoid the double buffering although it would still delegate to the core for the conversion, assuming the core may have implementation-specific FP support.
The final use was in IPAddress and that looks like it can simply be changed to used snprintf
- Dominant language
- C++
- Stars
- 306
- Forks
- 150
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from arduino/ArduinoCore-API
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
arduino/ArduinoCore-API#261 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 30/100
arduino/ArduinoCore-API#256 ·
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 48/100
arduino/ArduinoCore-API#251 · 1 comment ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 35/100
arduino/ArduinoCore-API#250 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
arduino/ArduinoCore-API#249 ·
All issues in arduino/ArduinoCore-API
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100