gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 14:34:52 24 4
gpt4 key购买 nike

我正在将函数传递给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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com