Typedef and enum with same name?
问题 In the library FreeImagePlus, in FreeImage.h, there is a funny #define which seems to create a typedef and an enum with the same name: #define FI_ENUM(x) typedef int x; enum x This is expanded by the preprocessor to code like: typedef int FREE_IMAGE_FILTER; enum FREE_IMAGE_FILTER { FILTER_BOX = 0, FILTER_BICUBIC = 1, [...] What does this do? Is it even legal to have a typedef and an enum with the same name? And isn't an enum compatible to int anyway? Why does FreeImage do this? 回答1: Names of