T
thomas
Hi, I need your help.
----------
struct SvrList{
unsigned int uNum;
GameSvr svr[0]; //line A
};
---------
Once I declared a struct like this to store server list info.
It's supposed to be used like this.
----------
SvrList* pList = (SvrList*)malloc(sizeof(
SvrList) + svrNum*sizeof(GameSvr));
pList->uNum, pList->svr[0], pList->svr[1].... blabla..
---------
The vs2005 compiler gives me the "nonstandard extension used : zero-
sized array in struct/union" warning though.
I may keep my eye closed to the warning since everything looks fine.
But I don't know whether anything bad may happen to me some day due to
running environment changes(porting to different platforms, or any
other conditions).
One work-around way is to declare a one-sized array as struct member,
but I didn't see any substantial changes except no warning in this
case.
Any body give some suggestions?
----------
struct SvrList{
unsigned int uNum;
GameSvr svr[0]; //line A
};
---------
Once I declared a struct like this to store server list info.
It's supposed to be used like this.
----------
SvrList* pList = (SvrList*)malloc(sizeof(
SvrList) + svrNum*sizeof(GameSvr));
pList->uNum, pList->svr[0], pList->svr[1].... blabla..
---------
The vs2005 compiler gives me the "nonstandard extension used : zero-
sized array in struct/union" warning though.
I may keep my eye closed to the warning since everything looks fine.
But I don't know whether anything bad may happen to me some day due to
running environment changes(porting to different platforms, or any
other conditions).
One work-around way is to declare a one-sized array as struct member,
but I didn't see any substantial changes except no warning in this
case.
Any body give some suggestions?