No idea why I'm getting this error. I copied this line from build.c
for ( x = 0; x < (sizeof(o_flags) / sizeof(o_flags[0])); x++ )
To act_wiz.c and it's getting that error. I know o_flags is extern'd in mud.h:
extern char * const o_flags [];
So act_wiz.c should know what it is. Any ideas?
30 Sep, 2007, David Haley wrote in the 2nd comment:
Votes: 0
It doesn't know the size of the o_flags array, because its extern definition doesn't specify the size, and therefore sizeof can't tell you what the size is.
30 Sep, 2007, David Haley wrote in the 5th comment:
Votes: 0
Zeno said:
Ah okay. Hm, what would you recommend?
You need to have the array declared with its size in the same "file" (source + relevant includes) for sizeof to give you the size of the block of memory used for that array. Either that, or use constants or something to keep track of the flags array size.
Caius's suggestion is a good way to have a function that will give you the size of the array, so that you can leave that function in the file where the array's size is defined, and still be able to access that size information from files in which you cannot specify the array's size. (Multiple definitions and all that.)
To act_wiz.c and it's getting that error. I know o_flags is extern'd in mud.h:
So act_wiz.c should know what it is. Any ideas?