c - Unable to expand certain macros (GNU99 Compiler) -


i'm trying understand c pre-processor using -e flag gcc.

gcc -e -wall simplesocket.c 

my source code (keeping simple):

#include<stdio.h> #include<sys/socket.h>  int main(){     int socketid = 0;     int socket_protocol = 6;      socketid = socket(af_inet,sock_stream,socket_protocol);     printf("socket created %d",socketid);     return 0; } 

the substituted code shows up:

int main(){                                                                                                                                                                                                                                                  int socketid = 0;                                                                                                                                                                                                                                           int socket_protocol = 6;                                                                                                                                                                                                                                     socketid = socket(2,sock_stream,socket_protocol);                                                                                                                                                                                                           printf("socket created %d",socketid);                                                                                                                                                                                                                    return 0;                                                                                                                                                                                                                                               } 

sock_stream not replaced although defined in socket.h library. i'm not able figure out why happened? i'm using gnu99 compiler.

thanks help.

sock_stream not expanded because it's not macro.

i grabbed copy of code , ran through gcc -e on system, , got similar results. if search output sock_stream, you'll find definition similar (i've deleted blank lines comments):

enum __socket_type {   sock_stream = 1,   sock_dgram = 2,   sock_raw = 3,   sock_rdm = 4,   sock_seqpacket = 5,   sock_dccp = 6,   sock_packet = 10,   sock_cloexec = 02000000,   sock_nonblock = 00004000 }; 

(an enumeration constant constant expression of type int.)


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -