I am reading the source code of Libevent2.0 and I find the code below which I cannot understand. Why can we access the element "ev_ncalls" without access to "_ev" and "ev_signal"? And I executed some codes like those that cannot go through gcc. Here is the code:
struct event { union { struct { TAILQ_ENTRY(event) ev_io_next; struct timeval ev_timeout; } ev_io; struct { TAILQ_ENTRY(event) ev_signal_next; short ev_ncalls; short *ev_pncalls; } ev_signal; } _ev; }; struct event *ev; int ncall = ev->ev_ncalls;
source share