What does it mean by “#define X X”?
问题 In Linux header file epoll.h , I found the following code: enum EPOLL_EVENTS { EPOLLIN = 0x001, #define EPOLLIN EPOLLIN ... } What does it mean by #define EPOLLIN EPOLLIN ? 回答1: This create a macro named EPOLLIN whose replacement text is also EPOLLIN . This is most likely a way for the preprocessor to check which event codes are available and conditionally compile code as necessary. If we go to the git repo for glibc and look at the output of git blame we see the following for enum EPOLL