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

WString: return bool instead of unsigned char #7939

Merged
merged 2 commits into from
May 15, 2021

Conversation

mcspr
Copy link
Collaborator

@mcspr mcspr commented Mar 25, 2021

Clean up the intent, resulting assembly stays the same as far as I could tell (objdump + vimdiff)
Follow-up #7781

if(s) helper is kind of redundant though, since c_str()buffer() may never be nullptr and always points to something. Still needed to be compatible though, if something uses it

Clean up the intent, resulting assembly stays the same.
Copy link
Collaborator

@earlephilhower earlephilhower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I really like the idea, @mcspr !

That said, I'm worried about changing the signature of something as basic as String. Even today, in the ArduinoAPI repo String.h uses unsigned char. So this change would move our interface away from that, and break anything inheriting from String.
https://github.com/earlephilhower/ArduinoCore-API/blob/9da53735171f7cccbe781c66d9ee1068d94d6ec8/api/String.h

So I'm honestly not sure which way to go here. Let's discuss and see if we can get anyone else's input.

@mcspr
Copy link
Collaborator Author

mcspr commented May 15, 2021

I may be missing the actual issue, but since this is not virtual inheritance methods do not depend on the base signature:
https://godbolt.org/z/x9b5be8b4
Removing the implementation will use the BaseX method implicitly, but if method signature is actually different one needs to do a using BaseX::method; to make it use the base method.

Also opened a PR to the ArduinoCore-API with a similar change

@earlephilhower earlephilhower self-requested a review May 15, 2021 21:41
Copy link
Collaborator

@earlephilhower earlephilhower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid explanation. I'm happy to give this a shot and see if we uncover some weirdness in ancient libs, since it looks like the odds are very low.

@earlephilhower earlephilhower merged commit 0aaadd9 into esp8266:master May 15, 2021
@mcspr mcspr deleted the string-bool-success branch May 26, 2021 08:40
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.

2 participants