Skip to contentSkip to conversation

static struct initialization question

DISCUSSION Jean Delvare 1 participant 1 message Jun 12, 2005

lore
Share & tools
lore
#0 lore raw

Hi all,

I need to statically intialize a structure which looks like:

struct items

{
	int first;
	int *others;
}

Where "others" points to a 0-terminated list of ints.

I plan to initialize it that way:

static struct items s = {
	.first = 1;
	.others = (int[]) {
		2,
		3,
		0
	}
};

It works fine here with gcc 3.3.4. Question is, is this style allowed in the kernel? I think it's C99 standard. I only found such constructs in arch/ppc/syslib/mpc*.c and sound/usb/usbquirks.h.

Thanks,

Signature · 1 line
Jean Delvare