1
wy315700 2014 年 7 月 26 日
Myfunc 是一个函数类型
static的意思是本文件作用域 |
2
zeayes 2014 年 7 月 26 日 typedef int Myfunc(const char *, const struct stat *, int);
// Myfunc是一个有3个参数(分别是:const char *, const struct stat *, int)且返回值是int的函数类型。 static Myfunc myfunc; // 申明一个Myfunc类型的静态变量。 typedef int (*Myfunc)(const char *, const struct stat *, int); // Myfunc是一个有3个参数(分别是:const char *, const struct stat *, int)且返回值是int的函数指针。 |
3
baka 2014 年 7 月 26 日 函数名或函数指针对编译器而言,结果实际上是一样的。
以函数名调用的时候,编译器会做function to pointer conversion,这样还是会拿到函数入口指针,相当于做了&myfunc |