Overriding enum C # define enums

I noticed something in the C headers that I can't figure out why. For example, bits/socket.hthere is an enumeration type in the file enum __socket_type, but after each enumerator there is a defining macro that defines the same thing. Example:

enum __socket_type
{
   SOCK_STREAM = 1,
   #define SOCK_STREAM SOCK_STREAM 
   ...
};

I could not find out what it is for. Please enlighten me. I don’t even know how to form the correct question for google request and this site search box.

+5
source share
3 answers

, , #define, , . , .

#ifdef SOCK_STREAM
..
#endif

.

: , ( ) .

+4

, , , , NUM_FILES, , , :

#ifdef NUM_FILES

, #define NUM_FILES NUM_FILES, IDE .

+5

I would suspect this for an IDE or other tools to understand that a certain character is defined.

0
source

All Articles