Skip to content

Change put()/putChanged() return type to next writable address#50

Open
Harry2907 wants to merge 1 commit into
sparkfun:mainfrom
Harry2907:feature/put-returns-next-address
Open

Change put()/putChanged() return type to next writable address#50
Harry2907 wants to merge 1 commit into
sparkfun:mainfrom
Harry2907:feature/put-returns-next-address

Conversation

@Harry2907

Copy link
Copy Markdown

Summary: Changes put() and putChanged() to return uint32_t (the next writable address) instead of T&/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() against arduino:avr:uno via arduino-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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Return type of put and get.

1 participant