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)
命名参数没有区别.
这意味着当您声明参数时struct timespec const[2],2在[和之间]不需要.将代码更改为:
bool cpfs_utimens(struct Cpfs *, char const *path, struct timespec const[]);
Run Code Online (Sandbox Code Playgroud)
在C/C++中,您不能要求将特定大小的数组作为参数,因为数组被视为指针而指针没有大小.