Change put()/putChanged() return type to next writable address#50
Open
Harry2907 wants to merge 1 commit into
Open
Change put()/putChanged() return type to next writable address#50Harry2907 wants to merge 1 commit into
Harry2907 wants to merge 1 commit into
Conversation
Previously put() and putChanged() returned T&/const T&, a holdover from the Arduino internal EEPROM library this is based on. This makes the return value largely useless since callers already have the object they passed in. This changes the return type to uint32_t, returning the next writable EEPROM address, enabling chained calls similar to the existing putString() behavior. This is a breaking change to the return type, explicitly approved by the maintainer in the issue discussion. Fixes sparkfun#36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary: Changes
put()andputChanged()to returnuint32_t(the next writable address) instead ofT&/const T&.Motivation: As discussed in #36, the current return type is a holdover from Arduino's internal EEPROM library and isn't useful since callers already hold the object. Returning the next address enables chaining, consistent with
putString().Breaking change: Yes — return type changes. Confirmed acceptable by @nseidle in the issue thread.
Testing: Compiled all example sketches using
put()/putChanged()againstarduino:avr:unoviaarduino-cli— all compile clean with--warnings all. No example captures the old return value, so nothing in the repo relies on the previous behavior.Fixes #36