我有一个应用程序,我必须声明(覆盖)从接口继承的方法。但是,这些方法具有在我的实现中未使用的参数。 class MyImplementation implements ISomething {
public function foo($bar) {
// code that does nothing with $bar
...
}
// oth
为什么此代码会导致2种不同的警告? class Abc
{
public:
Abc() = default;
Abc(Abc const&) = default;
};
int main()
{
int val1{int()};
Abc val2{Abc()};
}
编译输出: main.cpp: In function 'int ma
我有这个MCVE它编译没有任何警告: auto foo() -> void
{
int unused = 0;
unused++;
}
对我来说,我希望error: variable ‘unused’ set but not used [-Werror=unused-but-set-variable]。 这MCVE也编译没有任何警告: auto foo() -> voi
的say模块带来的字符串插值到Python,像这样: import say
def f(a):
return say.fmt("The value of 'a' is {a}")
然而,pylint的抱怨变量“A”是从来没有使用过。这是一个问题,因为我的代码广泛使用say.fmt。我该如何沉默这个警告?