Annoying Compiler Warning
-
I have the following code in my program (written in C not C++):
typedef struct
{
char *(*errors)[];
}ERROR_LIST;char *errors[]=
{
"An error",
"Another error",
};ERROR_LIST err_list={&errors}; // <--- Error on this line
The declaration gives the following compiler error on the line indicated. warning C4048: different array subscripts : 'char *(*)[]' and 'char *(*__w64 )[2]' I am using the /w64 compiler switch intentionally to maintain 64bit compatibility. Could somebody please give me a clue how to resolve this warning as its driving me nuts! Systems AXIS Ltd - Software for Business ...
-
I have the following code in my program (written in C not C++):
typedef struct
{
char *(*errors)[];
}ERROR_LIST;char *errors[]=
{
"An error",
"Another error",
};ERROR_LIST err_list={&errors}; // <--- Error on this line
The declaration gives the following compiler error on the line indicated. warning C4048: different array subscripts : 'char *(*)[]' and 'char *(*__w64 )[2]' I am using the /w64 compiler switch intentionally to maintain 64bit compatibility. Could somebody please give me a clue how to resolve this warning as its driving me nuts! Systems AXIS Ltd - Software for Business ...
-
And like this ? :
typedef struct { char *(*errors)[]; } ERROR_LIST; char *errors[]; ERROR_LIST err_list={&errors}; char *errors[]={"An error","Another error",};
That works but can you explain why? Systems AXIS Ltd - Software for Business ...
-
That works but can you explain why? Systems AXIS Ltd - Software for Business ...
I'm not a guru but I suppose the the compiler interpret (well a compiler does'nt interpret code, but...) : char *str[] = {"one", "two"}; as char *str[2] = {"one", "two"}; I think (not shure) that your code might compile in old C but not in C++ (new behaviour).