One header socket.h
on my Linux system looks like the following.
/* Bits in the FLAGS argument to `send', `recv', et al. */
enum
{
MSG_OOB = 0x01, /* Process out-of-band data. */
#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
...
Defining an enum
is sort of an idiom for creating type-safe-ish constants in C that the language actually treats as compile-time constants.
My question is : what purpose does the definition of macros MSG_OOB
, MSG_PEEK
, … that expand to themselves serve?