Re: structure packing

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

 



Mohamed Shafi <shafitvm@xxxxxxxxx> writes:

>     I thought so. With STRICT_ALIGNMENT = 1 the compiler makes sure
> that all access are aligned. So irrespective of whether the structure
> is aligned or not to be safe it generates byte access. Am i right?
> If so in the given example the base address is 0 and the offset will
> be known to the compiler. If the compiler is aware of these two
> information can't it decide whether the structure is aligned or not?

I'm not sure.  If the compiler knows the alignment of the specific
object, it may take that into account to override the packed attribute.
However, I would not be surprised if a specific case like casting 0 to
an address does not record the alignment even though it is known, since
that is such an odd case.

Ian

[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