有如下一段代码,为何在外部可以访问ev_ncalls而不需要经过_ev和ev_signal两层封装呢?
event的结构如下
struct event {
union {
/* used for io events */
struct {
TAILQ_ENTRY(event) ev_io_next;
struct timeval ev_timeout;
} ev_io;
/* used by signal events */
struct {
TAILQ_ENTRY(event) ev_signal_next;
short ev_ncalls;
/* Allows deletes in callback */
short *ev_pncalls;
} ev_signal;
} _ev;
};
struct event *ev;
int ncall = ev->ev_ncalls;