c - ((void (*)(int))-1) 是什么意思?

标签 c

<分区>

我刚找到这个。

// /usr/include/sys/signal.h // OS X
#define SIG_ERR ((void (*)(int))-1)

((void (*)(int))-1) 部分是什么意思?

有什么不同

#define SIG_ERR -1

?

最佳答案

这被转换为一个函数指针:

((type) value)

其中 type 是 void (*)(int),它是指向接受一个 int 参数并返回 void 的函数的指针,这实际上是是信号处理程序的签名:

typedef void (*sighandler_t)(int);

您可以使用cdecl 工具或网站解码这些类型:http://cdecl.org/

关于c - ((void (*)(int))-1) 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30702288/

相关文章:

c - 在 Unix 上查找已编译库的依赖项

c - 在现代 POSIX 环境中除了 usleep 还能用什么?

c - 聚合计算器中的意外输出

c - 如何对二维数组中的行和列使用一个函数?

c - C语言中的 '\'运算符是什么?

C 中的布谷鸟哈希

c - 在 C 中将 int 移位 32 次

c++ - 错误 : invalid conversion from ‘void*’ to ‘test::apr_size_t* {aka long unsigned int*}’ [-fpermissive]

C - 指针和整数 ('char *' 和 'int' 之间的比较

c - mpi 中的进程以什么顺序执行...我的意思是排名顺序?例如 : rank==0 first and rank==1 next?