Re: gcc structures

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

 



On 8 September 2013 14:22, JimJoyce wrote:
> Thanks, Jonathan, for your speedy reply.
>
> However, I'm surprised, That 'C' can pad structures as it sees fit.
> I thought the point and value of user-defined structures was to suit user's
> needs.
> not the whim of the compiler..

It's not the whim of the compiler, it's due to the hardware. See
http://c-faq.com/struct/padding.html and the links on that page.

> I think you're telling me that   '__attribute__((__packed__))'   is what I
> need to do  to force the compiler to do things my way?

Yes, but that's not portable and might slow the code down if the
hardware has to perform unaligned accesses to doubles.




[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