#defines inside an enum
I was looking at linux/include/linux/rtnetlink.h
Code:
enum { Note I'm not talking about this rtnetlink.h functionality specifically... just in general, the only place I've seen #defines embedded in enum's is in linux code. |
Those #defines seem to be intended to sort of undefine those symbols as preprocessor symbols right after potentially using the preprocessor symbols to define names in the enum.
Out of context, I'm failing to guess the intent. The preprocessor acts as if it were executed before the rest of compilation, so the preprocessor does not care that the #define happens to land inside the body of the enum definition. Edit: After using google, I have a better guess (mainly expanding on the answer that you seem to have gotten when asking the same question in a different forum): Assuming there are many variants of rtnetlink.h floating around (for different OS's etc.) and some of those defined RTM_BASE by #define and some didn't define it at all, then user code depending on rtnetlink.h but wanting to be portable would include code such as Code:
#ifdef RTM_BASE |
Preprocesssor does run in a separated process before the compilation, and yes, these defines are meant for #ifdef's.
|
All times are GMT -5. The time now is 07:35 PM. |