- 论坛徽章:
- 0
|
- /* Types of sockets. */
- enum __socket_type
- {
- SOCK_STREAM = 1, /* Sequenced, reliable, connection-based
- byte streams. */
- #define SOCK_STREAM SOCK_STREAM
- SOCK_DGRAM = 2, /* Connectionless, unreliable datagrams
- of fixed maximum length. */
- #define SOCK_DGRAM SOCK_DGRAM
- SOCK_RAW = 3, /* Raw protocol interface. */
- #define SOCK_RAW SOCK_RAW
- SOCK_RDM = 4, /* Reliably-delivered messages. */
- #define SOCK_RDM SOCK_RDM
- SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based,
- datagrams of fixed maximum length. */
- #define SOCK_SEQPACKET SOCK_SEQPACKET
- SOCK_PACKET = 10 /* Linux specific way of getting packets
- at the dev level. For writing rarp and
- other similar things on the user level. */
- #define SOCK_PACKET SOCK_PACKET
- };
复制代码
这个是/usr/include/bits/socket.h里面的一段...
- note:~/C# cat b.c
- #include <stdio.h>
- int main ()
- {
- enum{
- X=1,
- #define X X
- y=2,
- #define Y Y
- };
- X;
- printf("%dn",X);
- return 0;
- }
- note:~/C# gcc -E b.c |tail
- X=1,
- y=2,
- };
- X;
- printf("%dn",X);
- return 0;
- }
- note:~/C#
复制代码
发现也并没有用到#define,想知道什么情况下需要这么写... |
|