boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 这个function pointer最后的那个int是什么意思?
相关主题
pointer to function
C++ online Test 又一题 (转载)
C or C++ test
C++ Template Question
function in c++
function pointer 和 call-back function 有什么区别?
[合集] C++ template question
听说pointer to member function只支持最多128个virtual functi
Python Q: function pass in struct pointer, come back with data filled
difference between: char** p and char*p[] ??
相关话题的讨论汇总
话题: int话题: function话题: pointer话题: parameter话题: signal
进入Programming版参与讨论
1 (共1页)
j******a
发帖数: 1599
1
linux signal的定义。
void (*signal(int signo, void (*func )(int)))(int);
这最后一个int是什么意思阿? 应该是那个function的parameter阿?
t****t
发帖数: 6806
2
void (*A)(int): declare A as [pointer to function that takes int as
parameter, with no return]
void (*A(....))(int): declare A as a function that returns [pointer to
function that takes int as parameter, with no return], taking whatever
parameter (...)
replace "..." with "int signo, void (*func)(int)", you get what it means:
declare signal as a function, that returns [pointer to function that takes
int as parameter, with no return], and takes two parameter: first is int,
second is [pointer to function that takes int as parameter, with no return].
The stuff in [] is precisely the protocol of a signal handler. So, declare
signal as a function, that returns pointer to (old) signal handler, and
takes int and pointer to (new) signal handler.

【在 j******a 的大作中提到】
: linux signal的定义。
: void (*signal(int signo, void (*func )(int)))(int);
: 这最后一个int是什么意思阿? 应该是那个function的parameter阿?

j******a
发帖数: 1599
3
非常清楚,谢谢大牛。

].

【在 t****t 的大作中提到】
: void (*A)(int): declare A as [pointer to function that takes int as
: parameter, with no return]
: void (*A(....))(int): declare A as a function that returns [pointer to
: function that takes int as parameter, with no return], taking whatever
: parameter (...)
: replace "..." with "int signo, void (*func)(int)", you get what it means:
: declare signal as a function, that returns [pointer to function that takes
: int as parameter, with no return], and takes two parameter: first is int,
: second is [pointer to function that takes int as parameter, with no return].
: The stuff in [] is precisely the protocol of a signal handler. So, declare

j*****I
发帖数: 2626
4
我觉得如果考虑stack操作会更加容易懂些. 可能外面那个函数的stack还没全退出开,
就进到return的那个函数里面去了。这种操作是不是算是C里面比较tricky的啦?

【在 j******a 的大作中提到】
: 非常清楚,谢谢大牛。
:
: ].

t****t
发帖数: 6806
5
what are you talking about...

【在 j*****I 的大作中提到】
: 我觉得如果考虑stack操作会更加容易懂些. 可能外面那个函数的stack还没全退出开,
: 就进到return的那个函数里面去了。这种操作是不是算是C里面比较tricky的啦?

p*********t
发帖数: 2690
6
函数名其实就是一个指针。

【在 j******a 的大作中提到】
: linux signal的定义。
: void (*signal(int signo, void (*func )(int)))(int);
: 这最后一个int是什么意思阿? 应该是那个function的parameter阿?

m*******l
发帖数: 12782
7
大哥,我说句话,不中听,可能
你的C/C++还需要加强啊.
我上面英语恢复了,好像大家没有看懂.

【在 j*****I 的大作中提到】
: 我觉得如果考虑stack操作会更加容易懂些. 可能外面那个函数的stack还没全退出开,
: 就进到return的那个函数里面去了。这种操作是不是算是C里面比较tricky的啦?

1 (共1页)
进入Programming版参与讨论
相关主题
difference between: char** p and char*p[] ??
请教 C++的一个困惑 (operator delete)
What does int & mean? C/C++ question
c++ interview question
C++ Q87: What is wrong with this swap function? (转载)
C++class指针转换
有关 template function 的一个问题
c++头文件太tmd恶心了
about STL functor and function pointers
c++ question
相关话题的讨论汇总
话题: int话题: function话题: pointer话题: parameter话题: signal