B
baumann@pan
hi all,
i defined a macro like the below
#define initSock() \
do{\
WSADATA ws_data;\
WSAStartup(0x0202,&ws_data);\
}while(0)
then in a function , i wrote
if(!initSock())
{
.....
}
but the compiler complains
main.c
e:\project\scanap\main.c(11) : error C2059: syntax error : 'do'
e:\project\scanap\main.c(11) : error C2065: 'ws_data' : undeclared
identifier
e:\project\scanap\main.c(11) : warning C4133: 'function' : incompatible
types - from 'int *' to 'struct WSAData *'
if i change the macro to static function, it's ok.
any help would be appreciated. thanks.
bauman@Pan
i defined a macro like the below
#define initSock() \
do{\
WSADATA ws_data;\
WSAStartup(0x0202,&ws_data);\
}while(0)
then in a function , i wrote
if(!initSock())
{
.....
}
but the compiler complains
main.c
e:\project\scanap\main.c(11) : error C2059: syntax error : 'do'
e:\project\scanap\main.c(11) : error C2065: 'ws_data' : undeclared
identifier
e:\project\scanap\main.c(11) : warning C4133: 'function' : incompatible
types - from 'int *' to 'struct WSAData *'
if i change the macro to static function, it's ok.
any help would be appreciated. thanks.
bauman@Pan