G
grid
Hi,
I am trying to populate an array of structures with values when I get
an error like :
typedefs.c:50: warning: initializer element is not computable at load time
typedefs.c:50: error: initializer element is not constant
typedefs.c:50: error: (near initialization for `rgDescInfo[3].NewValue')
typedefs.c:51: error: initializer element is not constant
typedefs.c:51: error: (near initialization for `rgDescInfo[3]')
typedef.c is being included in another .c file for compilation.
Below is the excert where it is failing.
unsigned short StatusArray[STATUS_ARRAY_SIZE];
struct tagDescInfo {
short uwDescField;
char *szDescFieldName;
int fHeader;
short fGettable;
short fSettable;
short fDefault;
unsigned long NewValue;
unsigned long DefaultVal;
short cbValue;
int size;
} rgDescInfo[] = {
1001, "SQL_DESC_COUNT", 1, 1|2|4|8, 1|4|2, 1|4|2, 1, 0,sizeof(short),(-8),
1099, "SQL_DESC_ALLOC_TYPE", 1, 1|2|4|8, 0, 1|2|4|8, 0, 1,
sizeof(short), (-8),
20, "SQL_DESC_ARRAY_SIZE", 1, 1|4, 1|4, 1|4, 5, 1, sizeof(short),(-5),
21, "SQL_DESC_ARRAY_STATUS_PTR", 1, 1|2|4|8, 1|2|4|8, 1|2|4|8,
(unsigned int)(StatusArray), 0L, sizeof(void *), (-4)
};
Just for information, I am using gcc-3.4.2 and the -m64 ( 64 bit
executable) option.This works fine when I compile for 32 bit but gives
the above errors while it compiles for 64 bit.
Can someone comment if this sounds like a problem from the C language
perspective.If not then I will take it to the gcc mailing lists.
TIA
I am trying to populate an array of structures with values when I get
an error like :
typedefs.c:50: warning: initializer element is not computable at load time
typedefs.c:50: error: initializer element is not constant
typedefs.c:50: error: (near initialization for `rgDescInfo[3].NewValue')
typedefs.c:51: error: initializer element is not constant
typedefs.c:51: error: (near initialization for `rgDescInfo[3]')
typedef.c is being included in another .c file for compilation.
Below is the excert where it is failing.
unsigned short StatusArray[STATUS_ARRAY_SIZE];
struct tagDescInfo {
short uwDescField;
char *szDescFieldName;
int fHeader;
short fGettable;
short fSettable;
short fDefault;
unsigned long NewValue;
unsigned long DefaultVal;
short cbValue;
int size;
} rgDescInfo[] = {
1001, "SQL_DESC_COUNT", 1, 1|2|4|8, 1|4|2, 1|4|2, 1, 0,sizeof(short),(-8),
1099, "SQL_DESC_ALLOC_TYPE", 1, 1|2|4|8, 0, 1|2|4|8, 0, 1,
sizeof(short), (-8),
20, "SQL_DESC_ARRAY_SIZE", 1, 1|4, 1|4, 1|4, 5, 1, sizeof(short),(-5),
21, "SQL_DESC_ARRAY_STATUS_PTR", 1, 1|2|4|8, 1|2|4|8, 1|2|4|8,
(unsigned int)(StatusArray), 0L, sizeof(void *), (-4)
};
Just for information, I am using gcc-3.4.2 and the -m64 ( 64 bit
executable) option.This works fine when I compile for 32 bit but gives
the above errors while it compiles for 64 bit.
Can someone comment if this sounds like a problem from the C language
perspective.If not then I will take it to the gcc mailing lists.
TIA