什么是未用参数?
例如,
Bool NullFunc(const struct timespec *when, const char *who)
{
return TRUE;
}
在C++中,能够把/*...*/
关于参数的注释。当然不是C语言。
发布于 2018-01-09 12:28:48
通常写这样的宏:
#define UNUSED(x) (void)(x)
可以对所有未使用的参数使用此宏。
例如:
void f(int x) {
UNUSED(x);
...
}
发布于 2018-01-09 13:34:40
在gcc中,可以使用unused
属性...
在实践中,可以通过__attribute__ ((unused))
例如
auto lambda = [](workerid_t workerId) -> void { };
成
auto lambda = [](__attribute__((unused)) _workerid_t workerId) -> void { } ;
https://stackoverflow.com/questions/-100003411
复制相似问题