2016年1月11日 星期一

[C] Announce multiple structure in one structure

struct exit_function {
        /*
         * 'type' should be of type of the 'enum ef_type' above but since we
         * need this element in an atomic operation we have to use 'long int'.
         */
        long int type; /* enum ef_type */
        union {
                struct {
                        oefuncp func;
                        void *arg;
                } on_exit;
                struct {
                        cxaefuncp func;
                        void *arg;
                        void* dso_handle;
                } cxa_atexit;
        } funcs;
};

Reference:

0 意見:

張貼留言