I cannot get designated initialiser syntax working when using a range. I know that designated initialisers are possible with arrays, and I want to initialize a struct array so that all members are the same at boot.
EDIT: error is
error: array index range in initializer exceeds array bounds 32 |
[0 ... NODELIST_LEN].dev_status = DW_DEV_DISABLED
typedef struct {
int dev_status;
}DW_data;
typedef struct{
DW_data list[NODELIST_LEN];
}DW_nodelist;
I have tried the following:
DW_nodelist dw_list = {
.list[0 ... NODELIST_LEN].dev_status = DW_DEV_DISABLED
}
DW_nodelist dw_list = {
.list = {
[0 ... NODELIST_LEN].dev_status = DW_DEV_DISABLED
}
}
I even gave these a whirl just for laughs:
DW_nodelist dw_list = {
.list = {
.dev_status[0 ... NODELIST_LEN] = DW_DEV_DISABLED
}
}
DW_nodelist dw_list = {
.list = [0 ... NODELIST_LEN].dev_status = DW_DEV_DISABLED
}
What am I doing wrong, is this even possible with a struct array?