Filter löschen
Filter löschen

What happend to %#ok<DEFNU>

10 Ansichten (letzte 30 Tage)
tommsch
tommsch am 25 Mai 2023
Bearbeitet: tommsch am 25 Mai 2023
In my last Matlab version ( I think R2020a ), I added %#ok<DEFNU> to functions (which were on purpose unused) to silence the Matlab linter warning.
Now in Matlab R2021a, Matlab linter gives me a warning that this warning suppression is not needed anymore. Since a lot of people will still use older versions of Matlab, I do not want to remove it, since then a warning appears in older versions.
  • Is this a R2021a bug, or
  • Did the behaviour of DEFNU change, or
  • was %#ok<DEFNU> removed (I doubt, because I still see it in the list of warnings in the "Preferences/Matlab/Code Analyzer"-window
---
Edit: I tried to make a MWE an found out that there seems to be a behaviour change, triggered by a usage of evalc.
function linttest1
eval('');
end
function dummy; end %#ok<DEFNU> % mlinter warning here about unnecessary DEFNU
Versus:
function linttest2
end
function dummy; end %#ok<DEFNU> % no warning here
I guess this answers my question.

Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by