Re: struct

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

 



Here's some information about the alignment of a structure.

https://stackoverflow.com/questions/381244/purpose-of-memory-alignment

Can use the type attribute - packed which is gcc extension
Described below
https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#Common-Type-Attributes

On Sun 30 Sep, 2018, 11:15 PM sundaresh, <sundaresh@xxxxxxxx> wrote:

> Why do struct's take up a lot more memory than the sum of the sizes of its
> members ? This increases by even a lot more the larger the struct gets . If
> the compiler is doing padding or aligning I would like to disable and not
> have that at all since it is unnecessarily wasteful of memory ? I
> encountered a similar problem when declaring floating point variables
> independently outside a struct. The problem becomes worse if these floating
> point variables are struct members.
>
>
>
> --
> Sent from: http://gcc.1065356.n8.nabble.com/gcc-Help-f629689.html
>



[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