K
Kevin P. Fleming
I've got an enum and a structure:
enum option_type {
O_STRING,
O_BOOL,
O_NUMBER
};
struct option_s {
char *name;
enum option_type type;
char *value;
char *def_value;
};
I want to define and initialize an instance of this structure:
static struct option_s foo_option = {
.name = "foo",
.type = O_STRING,
.def_value = "default"
};
With gcc-3.3.1, this works fine. With gcc-2.95.3, it complains about a
"missing initializer for .value". However, I know that the Linux kernel
uses this type of structure initialization, and it compiles OK with
gcc-2.95.3. Any ideas what's up here? I don't think this is actually a
syntax error on my part...
enum option_type {
O_STRING,
O_BOOL,
O_NUMBER
};
struct option_s {
char *name;
enum option_type type;
char *value;
char *def_value;
};
I want to define and initialize an instance of this structure:
static struct option_s foo_option = {
.name = "foo",
.type = O_STRING,
.def_value = "default"
};
With gcc-3.3.1, this works fine. With gcc-2.95.3, it complains about a
"missing initializer for .value". However, I know that the Linux kernel
uses this type of structure initialization, and it compiles OK with
gcc-2.95.3. Any ideas what's up here? I don't think this is actually a
syntax error on my part...