From K & R C Programming Language:
A non-user member of a structure or union can have any type of object.
A field member (which should not have a declarator and, therefore, may be anonymous) is of type int, unsigned int or signed int, and is interpreted as an object of an integral type of the specified length in bits; whether the int field is treated as signed is implementation dependent.
...
The non-field structure element is aligned along the addressing boundary depending on its type; therefore, there may be unnamed holes in the structure.
- I thought that members of a structure or union are called its fields. So what is a non-field member of a structure or union? How does it differ from a field member?
- Can you explain that “a member that is not a member of a structure or association can have any type of object” with some examples?
- The second sentence in the quote means that a field member can only have type int, unsigned int, or signed int?
- The last sentence in the quote mentions that the member without margins is aligned. Is a field element aligned? If not, how are member fields stored in memory?
Thanks.
source share