question on use of aligned attribute in a structure definition

Eric Sandeen sandeen@sgi.com
Fri Jun 17 17:39:00 GMT 2005


The method that I have always seen for defining an aligned member of a 
structure is something like this:

struct foo {
	int bar;
	uint64_t baz __attribute__((aligned(8)));
}

but I'm wondering if this is valid as well:

struct foo {
	int bar;
	uint64_t __attribute__((aligned(8))) baz;
}

I ask because of macro hell I'm dealing with in an existing codebase, where the 
latter format would fit the existing implementation of this particular 
codebase, IF it results in the same alignment for structure member "baz"...

Thanks,

-Eric



More information about the Gcc-help mailing list