Sign of Plain Bitfields

For some architectures, the sign of a plain bitfield does not follow standard rules. Normally for the bitfield in the following listing, myBits is signed, because plain int is also signed.

Listing: Signed Bitfield
struct _bits {
  int myBits:3;

} bits;

To implement this bitfield as an unsigned bitfield, use the code in the following listing.

Listing: Unsigned Bitfield
struct _bits {
  unsigned int myBits:3;

} bits;

However, some architectures must overwrite this behavior for Embedded Application Binary Interface ( EABI) compliance. Under those circumstances, the Compiler uses the -T: Flexible Type Management option, if supported. The option affects the following defines (as shown in the following listing):

Listing: Defines Affected by -T Option Use
__PLAIN_BITFIELD_IS_SIGNED__    /* defined if plain bitfield is signed */


__PLAIN_BITFIELD_IS_UNSIGNED__  /* defined if plain bitfield is unsigned */