I am migrating an old project up to be compiled in newer versions of Visual Studio. I am getting a compiler error C4430 while compiling an old struct:
struct SHOP_ITEM_LIST
{
char title[50];
char description[200];
_ARRAY(SHOP_ITEM); // Another Struct with some integer and char array values
};
I researched that error and made out that since VC++2005, missing type specifiers aren't allowed anymore. It's not being interpreted as integer anymore.
I am not familiar with std::_Array< _Tp > and dont know how it behaves when being used in a struct with sizeof().
Would int _ARRAY(SHOP_ITEM); just do the trick, or would it manipulate the size of the struct?
What is the proper way to upgrade this struct to VC++2005 and later?
It won't work if you put another type like
intin front of it. It also won't work if you simple replace it with a template likestd::_Array. It's clear from the context that_ARRAYwas a macro.I don't believe the definition for
_ARRAYwas provided by your Visual C++ 6 compiler. You should try to find out where it comes from. The simple fix may be to just include the file that defines it.Failing that then the
_ARRAYmacro was probably defined either something like this:or like this:
There should also be other macros that your code uses to do allocations and to access elements of the shop item array. Do you see other identifiers similar
_ARRAYin your code? They wouldn't necessarily generate compile time errors, as they would probably look like undeclared functions to the compiler, however you'll need to implement them as well.