[英]How to call a base class's virtual function that is an input argument to a function
[英]How to understand star sign(*) in function's function argument?
這是我的困惑:
extern int sigsegv_leave_handler (
void (*continuation) (void*, void*, void*),
void* cont_arg1, void* cont_arg2, void* cont_arg3);
我不了解*continuation
, *
*continuation
中*continuation
的用途是什么
更新
完整的代碼在Linux的“ /usr/include/sigsegv.h”中
更新
我使用sigsegv_leave_handler
如下所示:
void cont(void *fault_addr, void *arg1, void *arg2) {
// rb_raise(rb_eTypeError, "type err");
rraise(SEGV, NULL);
}
int handle_segv(void *fault_addr, int serious) {
sigsegv_leave_handler(cont, fault_addr, NULL, NULL);
}
這個
void (*continuation) (void*, void*, void*)
只是一個聲明,其中continuation
是指向使用3個void *
指針且不返回任何內容( 帶有void
return type )的函數的指針。
這是您聲明函數指針的方式,
RETURN_TYPE (*IDENTIFIER)(... PARAMETERS WITH THEIR TYPES AS USUAL ...);
有用的工具是C亂碼↔英文
extern int sigsegv_leave_handler (void (*) (void*, void*, void*), void* , void* , void* );
將sigsegv_leave_handler聲明為extern函數(指向函數的指針(指向void的指針,指向void的指針,指向void的指針)返回void,指向void的指針,指向void的指針,指向void的指針)返回int
換句話說, sigsegv_leave_handler()
接受4個參數並返回一個int
。
1) pointer to a function which takes 3 void * pointers and returns void
void (*f) (void*, void*, void*)
2) pointer to void
void *
3) pointer to void
void *
4) pointer to void
void *
*在* continuation中有什么用?
顯示參數是指向函數的指針。
void (*continuation) (void*, void*, void*),
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.