Skip to content

Conversation

@smoe
Copy link
Collaborator

@smoe smoe commented Jan 15, 2026

Also suppressing false positive report on use of undefined variable.

Also suppressing false positive report on use of undefined variable.
@BsAtHome
Copy link
Contributor

Instead of suppressing the cppcheck uninitialized warning, it may be appropriate just to initialize the pl variable like:

double p1[9], p2[9], pl[9] = {};

No comment on the mem-leak :-)

@smoe
Copy link
Collaborator Author

smoe commented Jan 16, 2026

Instead of suppressing the cppcheck uninitialized warning, it may be appropriate just to initialize the pl variable like:

double p1[9], p2[9], pl[9] = {};

I would like to keep the suppression as a reminder that the code is a bit tricky to read. Also, erroneously assigning a default value 0 or undefined is equally unfortunate, so the suppression is something like a quick statement that the devs are aware of the situation.

No comment on the mem-leak :-)

:)

@BsAtHome
Copy link
Contributor

I would like to keep the suppression as a reminder that the code is a bit tricky to read.

Tricky,... that is an understatement.

Also, erroneously assigning a default value 0 or undefined is equally unfortunate

That is not necessarily a problem. The real problem is that cppcheck cannot perform the correct analysis. The code and compound condition makes first and the value of pl mutually exclusive.

The cppcheck message is a false positive. If you suppress the message, then you should at least precede it with a comment why the message needs to be suppressed. That would help to understand the "tricky" code a bit better ;-)

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