Aligning on some odd address?

Philipp Marek philipp.marek@emerion.com
Thu Apr 16 06:38:00 GMT 2009


Hello everybody,

I'd like to know whether there's some way to get a structure aligned on a non-
aligned address.
Now that might sound a bit strange, but let me explain.

I'm having a lot of (constant) structures that include a count an an array, 
like this:

	struct {
		unsigned char count;
		struct something_else_t array[];
	}

Now I'd like to have the array (where each element has eg. 16, 32, or 48 
bytes) aligned - on at least a 4 byte boundary, but better still on 8/16/64 
bytes.

Is there some way to do that, *without* loosing much memory?
Optimally there'd be some way to get such structures put after static strings 
(which might end on an odd address anyway), so that the total memory lost 
would be a low as possible.

So, concluding: How can I specify that I want some member of a *packed* 
structure aligned, but not the structure itself?

Thank you for any help.


Regards,

Phil



More information about the Gcc-help mailing list