HID: Zero-initialize pointer members#19
Closed
forderud wants to merge 4 commits intoabratchik:masterfrom
Closed
Conversation
I'm new to Arduino development, so I'm not sure if variable are zero-initialized by default. Regardless, it's often regarded good practice to explicitly zero-initialize pointers to reduce risk of treating uninitialized pointers as valid.
2fe4b4d to
395e4a9
Compare
c279a76 to
15a16f2
Compare
Owner
|
HID.h/HID.cpp is a part of Arduino Core. If you check the original you will find that it was half-cooked. They only supported USB HID reports but not the features. You may check this PR - submitted it long ago to the Arduino team but they did not merge it for some reason. |
Contributor
Author
|
I just submitted the relevant subset of this PR to ArduinoCore-avr in arduino/ArduinoCore-avr#571. Let's wait and see how it's received. |
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.
I'm new to Arduino development, so I'm not sure if variable are zero-initialized by default. Regardless, it's often regarded good practice to explicitly zero-initialize pointers to reduce risk of treating uninitialized pointers as valid.
Combine with moving of other member initialization from constructor in cpp-file to header.