返回信息流请问:
typedef void (*ILibWebServer_Session_OnSendOK)(struct ILibWebServer_Session *sender);
是什么意思,能解释一下吗,谢谢?
这是一条镜像帖。来源:北邮人论坛 / soft-design / #23874同步于 2008/1/8
该镜像源已超过 30 天没有更新,可能在源站已被删除。
SoftDesign机器人发帖
关于typedef
merrylife
2008/1/8镜像同步15 回复
订阅后,新回复会通过你的通知中心匿名送达。
9 条回复
ILibWebServer_Session_OnSendOk is a pointer to a function which takes a pointer to a struct ILibWebServer_Session as parameter and returning void
参考 expert C programming
【 在 merrylife (Delia) 的大作中提到: 】
: 标 题: 关于typedef
: 发信站: 北邮人论坛 (Tue Jan 8 18:05:13 2008), 站内
:
: 请问:
: typedef void (*ILibWebServer_Session_OnSendOK)(struct ILibWebServer_Session *sender);
: 是什么意思,能解释一下吗,谢谢?
: --
:
: ※ 来源:·北邮人论坛 http://forum.byr.edu.cn·[FROM: 220.231.15.*]
【 在 sunway 的大作中提到: 】
: ILibWebServer_Session_OnSendOk is a pointer to a function which takes a pointer to a struct ILibWebServer_Session as parameter and returning void
: 参考 expert C programming
:
说得不太准确,请注意这个帖子的主题......前面没有typedef它确实是个pointer,有typedef它就是个类型的别名了
比如
typedef int (*F)(int a);//F是int(int) *这个类型的别名,这句可以看成typedef ( int(int) *) F
F func; //这儿func才是一个pointer
恩
【 在 sunway 的大作中提到: 】
: ILibWebServer_Session_OnSendOk is a pointer to a function which takes a pointer to a struct ILibWebServer_Session as parameter and returning void
: 参考 expert C programming
:
这么解释是比较正确的
【 在 yywbupt 的大作中提到: 】
: 说得不太准确,请注意这个帖子的主题......前面没有typedef它确实是个pointer,有typedef它就是个类型的别名了
: 比如
: typedef int (*F)(int a);//F是int(int) *这个类型的别名,这句可以看成typedef ( int(int) *) F
: ...................
那
typedef void * GetLock;
又是什么意思呢?
如果这么定义:
void * GetLock; //应该等同于:typedef void * GetLock
是不是指GetLock可以指向任何类型的指针,不管是变量,函数还是结构?
【 在 yywbupt 的大作中提到: 】
: 说得不太准确,请注意这个帖子的主题......前面没有typedef它确实是个pointer,有typedef它就是个类型的别名了
: 比如
: typedef int (*F)(int a);//F是int(int) *这个类型的别名,这句可以看成typedef ( int(int) *) F
: ...................
typedef,typedef
顾名思义,其是为了定义一个类型的别名
而你直接写void * getlock
这定义的是一个变量
类型和变量可要分清楚阿
【 在 merrylife 的大作中提到: 】
: 那
: typedef void * GetLock;
: 又是什么意思呢?
: ...................
god please
" typedef oldType newType; "
then you can use "newType" to define variable you want
if you want have an int variable 5,
you can simply type " int num=5; "
or
" typedef int MyInt; " and " MyInt num=5; "
that is it.
问个小问题
typedef int MyInt
和
#define MyInt int
有什么区别?
【 在 difuk (胖夫||The world) 的大作中提到: 】
: god please
: " typedef oldType newType; "
: then you can use "newType" to define variable you want
: ...................