zero width for bit-field

zero width for bit-field.

Description


  • The compiler has detected a bit-field with zero width

Causes


  • Named bit fields cannot have zero width.
  • Bit fields can have zero width only if unnamed.

Example


Output


How to fix it ?


  • To resolve this error, you can:
  • Change the bit field to a nameless bit field .
  • Remove the bit field.
  • Change the value of the bit field to an integer constant expression with a value greater to zero.

syntax:


  • A bit field declaration is a struct or union member declaration which uses the following syntax:

  <type<Identifier(optional)>  :  <width>

  • Type
  • An integer type.(unsigned int, signed int, int, _Bool)
  • Identifier
  • the name of the bit field that is being declared.
  • The name is optional
  • Width
  • an integer constant expression with a value greater or equal to zero and less or equal the number of bits in the underlying type.

See also


Subscribe to our channel.

Leave a Reply

Your email address will not be published. Required fields are marked *