开发者

int depth UNUSED_PARAM

开发者 https://www.devze.com 2023-02-09 10:42 出处:网络
static FAST_FUNC int fileAction(const ch开发者_如何学Goar *pathname, struct stat *sb UNUSED_PARAM,
static FAST_FUNC int fileAction(const ch开发者_如何学Goar *pathname,
    struct stat *sb UNUSED_PARAM,
    void *modname_to_match,
    int depth UNUSED_PARAM){...}

what does "int depth UNUSED_PARAM" mean ?


From include/platform.h in Busybox-1.18.3:

#define UNUSED_PARAM __attribute__ ((__unused__))

And from the GCC documentation:

unused
This attribute, attached to a variable, means that the variable is meant to be possibly unused. GCC will not produce a warning for this variable.

So, it is just a way to tell both the human programmers and the compiler that the variable is not necessarily used. Otherwise, the compiler may warn you about an unused variable.

Presumably, fileAction requires the depth parameter to be compatible with a function pointer type or other API constraints but fileAction doesn't actually use the parameter.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号