Bui*_*ded 2 c++ compiler-warnings
void func(char * param)
{
#ifdef _XYZ_
.....somecode here using param
#endif
.....lots of code here not using param
}
Run Code Online (Sandbox Code Playgroud)
编译出错,我什至不希望在代码中发出警告。
从 C++17 开始,我们具有抑制未使用实体的警告的maybe_unused属性:
void func([[maybe_unused]] char * param)
{
#ifdef _XYZ_
.....somecode here using param
#endif
}
Run Code Online (Sandbox Code Playgroud)