Re: Aligning on some odd address?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fabian Cenedese <Cenedese <at> indel.ch> writes:
> >You'd lose that memory anyway if the compiler aligns it himself.
> 
> I overlooked the packed requirement, but in that case you can just turn
> it around:
> 
>         struct {
>                 unsigned char dummy[7]; // for 8 byte alignment
>                 unsigned char count;
>                 struct something_else_t array[];
>         }
> 
> Align the struct to 8 bytes and you have your array aligned to 8 bytes.
Yes ... but that wastes a bit of storage, especially if you have several
thousand of these structures, and need to align to 32byte ...

As I can say "align this to 16 byte", I thought I'll ask whether I can say
"align this to 15 (module 16) byte", and maybe get the linker to use the space
before that for some odd data (like ASCIIZ-strings).

Well, thanks anyway.


Regards,

Phil



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux