Skip to content

Conversation

gunterkoenigsmann
Copy link

CppCheck, if all warnings are enabled, complains if one calls memset on something that contains a float variable.
In our case setting the variable to 0 is what we actually intent which means we can tell cppcheck to mute these warnings.

CppCheck, if all warnings are enabled, complains if one calls
memset on something that contains a float variable.

In our case setting the variable to 0 is what we actually intent
which means we can tell cppcheck to mute these warnings.
@v0lt
Copy link

v0lt commented May 30, 2022

I think writing weird comments is a bad idea.
I can suggest replacing calls to malloc and memset with a single call to calloc.

It was:

p = (NSVGparser*)malloc(sizeof(NSVGparser));
if (p == NULL) goto error;
memset(p, 0, sizeof(NSVGparser));

It became:

p = (NSVGparser*)calloc(1, sizeof(NSVGparser));
if (p == NULL) goto error;

@v0lt
Copy link

v0lt commented May 30, 2022

I also think it's bad form to create a lot of pull requests based on cosmetic statistical analyzer warnings.

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