mne-cpp icon indicating copy to clipboard operation
mne-cpp copied to clipboard

Remove unnecessary null pointer checks

Open elfring opened this issue 4 years ago • 6 comments

Extra null pointer checks are not needed in functions like the following.

elfring avatar Oct 30 '21 13:10 elfring

All these are very good catches. Thanks. Would you be willing to PR the changes?

juangpc avatar Nov 01 '21 14:11 juangpc

:thought_balloon: Would you become interested to use a development tool like “clang-tidy” for corresponding source code adjustments?


How do you think about to adjust any more source code places? :thinking:

elfring avatar Nov 01 '21 14:11 elfring

Yes, we use it. As shown in different places here https://mne-cpp.github.io/pages/development/contribute.html, we use qtcreator for development and that brings clang-tidy by default. But we have an unsurmountable amount of warnings. So I guess the ones you are mentioning are probably there... We keep addressing them frequently, although not frequently enough.

juangpc avatar Nov 01 '21 15:11 juangpc

How do you think about to improve the software situation any more by influencing evolution according to development tools for automatic source code adjustments? :thinking:

elfring avatar Nov 01 '21 15:11 elfring

That's a good idea. But I think that the chances of a fix generating more harm than good are, in my opinion too high. Our testing pipeline, or our coverage, aren't in great either. So it would mean that it would be hard to catch the generated problem. Bear in mind that some of our libraries inherit from c libraries which implement a particular way of managing memory. This means that these components live a long way from raii.

juangpc avatar Nov 01 '21 15:11 juangpc

Search patterns can be specified for questionable source code places. They can become more sophisticated on demand, can't they? :thinking:

elfring avatar Nov 01 '21 15:11 elfring