Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return type of put and get. #36

Open
SpintroniK opened this issue May 2, 2024 · 2 comments
Open

Return type of put and get. #36

SpintroniK opened this issue May 2, 2024 · 2 comments

Comments

@SpintroniK
Copy link

Subject of the issue

Just wondering why the return type of put is T&? (same for get).
I don't really see why these functions return the value we feed them with.
I wonder if it wouldn't make more sense to have put return the next writable location, kind of like putString.
That way, it would become possible to save structs one after another, by using the returned value as the next address.
Perhaps it would also make sense if get just returned void.
What do you guys think?

Your workbench

  • Not relevant.

Steps to reproduce

Not relevant.

Expected behavior

Not relevant.

Actual behavior

Not relevant.

@nseidle
Copy link
Member

nseidle commented Jul 11, 2024

Sorry for the late reply. I suspect the return type is just a hold over from the Arduino internal eeprom library (what this library is based on).

I'm very open to changing the return type for put. I doubt many folks are using it so I'm ok with a breaking change.

@SpintroniK
Copy link
Author

Hi, no worries.
I think it would be a lot nicer if put returned the next writable address.
That'd be quite useful, in fact, as it would allow to chain calls to put quite easily.

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

No branches or pull requests

2 participants