c - : void * _Nullable (* _Nonnull)(void * _Nullable)的含义

标签 c function

我正在将函数传递给pthread_create函数。我收到一条警告,提示作为参数传递的函数类型不兼容:

void * _Nullable (* _Nonnull)(void * _Nullable)

我设法通过将我的函数声明为来修复它:

void *incFunc(void *ptr){
    for (long i = 0; i < COUNT; ++i) { counter++;}
    return NULL;
}

,但我不太明白预期参数类型的含义:

void * _Nullable (* _Nonnull)(void * _Nullable)
  • void * _Nullable ==函数的返回类型应该是指向void的指针
  • (void * _Nullable) == 接受的参数是指向 void 的指针
  • (* _Nonnull) ????这是我不懂的

(* _Nonnull) 代表什么?

最佳答案

这意味着:

它必须不是 NULL 函数指针,它采用 void * 参数,该参数可以为 NULL 并返回 void *。返回值可以为NULL。

关于c - : void * _Nullable (* _Nonnull)(void * _Nullable)的含义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58789151/

相关文章:

python - 我可以从 python 脚本运行 shell 函数吗?

c - 如何使用 C 程序在 linux 中获取接口(interface)的 mac 地址?

c - sizeof(int) <= sizeof(long) <= sizeof(long long) 总是正确的?

将 "c99"循环转换为常规内容

c - 从函数返回结构

未在函数范围内声明的 Javascript 变量

r - 使用 data.table [R] 查找组的模态值出现次数

c++ - 是否有工具/解决方案来编写一个循环,其中仅在每 X 次迭代中检查条件?

c - c 中的 typedef 和类型等价

python - 递归函数没有返回我想要的