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

refactor: cleanup PacketResponseNG init #2536

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

douniwan5788
Copy link
Contributor

No description provided.

Copy link

You are welcome to add an entry to the CHANGELOG.md as well

@iceman1001
Copy link
Collaborator

I actually deliberately set all the fields to zero manually because the shortcut version of assigning zero doesn't always clear out all memory.

@iceman1001 iceman1001 closed this Sep 24, 2024
@iceman1001
Copy link
Collaborator

You could do a "memset(payload, 0, sizeof, " instead.

@douniwan5788
Copy link
Contributor Author

I actually deliberately set all the fields to zero manually because the shortcut version of assigning zero doesn't always clear out all memory.

According to the C99 Standard 6.7.8.21, all remaining fields will be initialized. Do you have a reproducible case? Could it be an old compiler bug?

If there are fewer initializers in a brace-enclosed list than there are elements or members of an aggregate, or fewer characters in a string literal used to initialize an array of known size than there are elements in the array, the remainder of the aggregate shall be initialized implicitly the same as objects that have static storage duration.

@iceman1001
Copy link
Collaborator

Hard core experience. So we are not doing this way.

@douniwan5788
Copy link
Contributor Author

memset(payload, 0, sizeof

ok, I'll replace it with the memset(payload, 0, sizeof) form. Will that reopen the PR?

@iceman1001
Copy link
Collaborator

Sure

@iceman1001 iceman1001 merged commit 14dcc9d into RfidResearchGroup:master Sep 24, 2024
12 checks passed
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