One socket.h header on my Linux system is as follows.
enum { MSG_OOB = 0x01, #define MSG_OOB MSG_OOB MSG_PEEK = 0x02, /* Peek at incoming messages. */ #define MSG_PEEK MSG_PEEK MSG_DONTROUTE = 0x04, /* Don't use local routing. */ #define MSG_DONTROUTE MSG_DONTROUTE ...
The definition of enum is a kind of idiom for creating type-safe-ish constants in C , which the language really treats as compile-time constants.
My question is: what is the purpose of the macros MSG_OOB , MSG_PEEK , ... that expand to themselves?
c c-preprocessor
Pascal Cuoq Feb 18 '14 at 13:28 2014-02-18 13:28
source share