例如,有很多typedef
s 到大量结构中ngx_core.h
typedef struct ngx_module_s ngx_module_t;
typedef struct ngx_conf_s ngx_conf_t;
typedef struct ngx_cycle_s ngx_cycle_t;
typedef struct ngx_pool_s ngx_pool_t;
typedef struct ngx_chain_s ngx_chain_t;
typedef struct ngx_log_s ngx_log_t;
typedef struct ngx_array_s ngx_array_t;
typedef struct ngx_open_file_s ngx_open_file_t;
typedef struct ngx_command_s ngx_command_t;
typedef struct ngx_file_s ngx_file_t;
typedef struct ngx_event_s ngx_event_t;
typedef struct ngx_event_aio_s ngx_event_aio_t;
typedef struct ngx_connection_s ngx_connection_t;
事实上,我知道结构名称如是ngx_module_s
可以使用的,为什么typedef
它与ngx_module_t
?这是好设计吗?而且,这样做有什么好处?
用 C 语言编程时,这是一种好的做法吗?而且,这种做法的名称是什么?为什么是好是坏?