这个夹板警告的含义是什么?我可能做错了什么?

Mat*_*ner 2 c linux gcc splint

这是代码行:

bool cpfs_utimens(struct Cpfs *, char const *path, struct timespec const[2]);
Run Code Online (Sandbox Code Playgroud)

运行夹板3.1.2生成此警告:

cpfs.h:21:74: Function parameter times declared as manifest array (size
                 constant is meaningless)
  A formal parameter is declared as an array with size.  The size of the array
  is ignored in this context, since the array formal parameter is treated as a
  pointer. (Use -fixedformalarray to inhibit warning)
Run Code Online (Sandbox Code Playgroud)

命名参数没有区别.

Ale*_*rty 5

这意味着当您声明参数时struct timespec const[2],2[和之间]不需要.将代码更改为:

bool cpfs_utimens(struct Cpfs *, char const *path, struct timespec const[]);
Run Code Online (Sandbox Code Playgroud)

在C/C++中,您不能要求将特定大小的数组作为参数,因为数组被视为指针而指针没有大小.

  • @Jack Kelly再次撇号...因为你问,对于这种尼特的SO方法是(从一个着名的维基借用一个短语)是大胆的,只要修复它,如果你有足够的代表来编辑它.如果没有,耐心通常会产生一个具有足够代表的用户来修复它.这样一来,大多数破碎的窗户都得到修复,而不用担心它. (2认同)