最近在看redis源码的时候看到Ae.h的时候看到如下源码:
/* Types and data structures */
typedef void aeFileProc(struct aeEventLoop *eventLoop, int fd, void *clientData, int mask);
typedef int aeTimeProc(struct aeEventLoop *eventLoop, long long id, void *clientData);
typedef void aeEventFinalizerProc(struct aeEventLoop *eventLoop, void *clientData);
typedef void aeBeforeSleepProc(struct aeEventLoop *eventLoop);
对于函数,typedef有两类自定义类型,恰好在Nginx和Redis中分别使用了一种风格。参见:函数指针--Nginx和Redis中两种回调函数写法
----以上选自《C语言编程:一本全面的C语言入门教程 (第3版)》
更深度的分析: