Skip to content

Fix bitWrite with parenthesis #1482

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

Merged
merged 1 commit into from
Aug 24, 2021
Merged

Fix bitWrite with parenthesis #1482

merged 1 commit into from
Aug 24, 2021

Conversation

positron96
Copy link
Contributor

Current version does not wrap arguments in "()", so works incorrectly when used like this:

bitWrite(var, bit, cond?1:0);

Same as in here: espressif/arduino-esp32#4466

Current version does not wrap arguments in "()", so works incorrectly when used like this:
```
bitWrite(var, bit, cond?1:0);
```


Same as in here: espressif/arduino-esp32#4466
@fpistm fpistm self-requested a review August 24, 2021 08:24
@fpistm fpistm added enhancement New feature or request fix 🩹 Bug fix labels Aug 24, 2021
@fpistm fpistm added this to the 2.1.0 milestone Aug 24, 2021
Copy link
Member

@fpistm fpistm left a comment

Choose a reason for hiding this comment

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

LGTM, even if I think value and bit does not need extra parenthesis anyway it is safe.

@fpistm
Copy link
Member

fpistm commented Aug 24, 2021

Hi @positron96,

thanks for this PR.
To go further, I would raised also an issue in the ArduinoCore-API:
https://github.com/arduino/ArduinoCore-API/blob/d06d9b27c9de71b871a6b80ca9bc67e5e7a6c603/api/Common.h#L68

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fix 🩹 Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants