Keil Logo

Structures, unions, enumerations, and bitfields

A.11 Structures, unions, enumerations, and bitfields

Describes implementation-defined aspects of the Arm® C compiler and C library relating to structures, unions, enumerations, and bitfields, as required by the ISO C standard.

Whether a plain int bit-field is treated as a signed int bit-field or as an unsigned int bit-field (6.7.2,
Plain int bitfields are signed.
Allowable bit-field types other than _Bool, signed int, and unsigned int (
Enumeration types, long and long long (signed and unsigned) are allowed as bitfield types.
Whether atomic types are permitted for bit-fields (
Atomic types are not permitted for bitfields.
Whether a bit-field can straddle a storage-unit boundary (
A bitfield cannot straddle a storage-unit boundary.
The order of allocation of bit-fields within a unit (
Within a storage unit, successive bit-fields are allocated from low-order bits towards high-order bits when compiling for little-endian, or from the high-order bits towards low-order bits when compiling for big-endian.
The alignment of non-bit-field members of structures ( This should present no problem unless binary data written by one implementation is read by another.
The non-bitfield members of structures of a scalar type are aligned to their size. The non-bitfield members of an aggregate type are aligned to the maximum of the alignments of each top-level member.
The integer type compatible with each enumerated type (
An enumerated type is compatible with int or unsigned int. If both the signed and the unsigned integer types can represent the values of the enumerators, the unsigned variant is chosen. If a value of an enumerator cannot be represented with int or unsigned int, then long long or unsigned long long is used.
Non-ConfidentialPDF file icon PDF version101754_0615_00_en
Copyright © 2019, 2020 Arm Limited or its affiliates. All rights reserved. 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.