BARfly Help - BAR Implementation File Reference - Structure Scope

  Bit field structure definitions

BitFieldStructureDefinition ::= (MemberBitFieldDeclaration | MemberFunctionDeclaration)*

At least one member variable declaration must appear.

MemberBitFieldDefinition ::= (SignAndEndianTypeModifiers? SimpleIntegralTypeName) S BitFieldVariableDeclaration (S? ‘,’ S? BitFieldVariableDeclaration)* S? ‘;’

A bit field variable declaration, which appears in a bit field structure, is slightly different from bit field declarations found in other languages similar in syntax to BAR.  No anonymous padding can be specified, and all bits of the bit field structure must be named.

Multiple integer types can be specified within the field; there is no restriction to just a single size.

The use of EndianTypeModifier allows the bit order to be qualified:  little-endian bit order or big-endian bit order.

The sizing constant is limited by the size of the type (8 for char, 16 for short, 32 for long, and 64 for longlong).  The minimum sizing constant is 1 for all types.

The bit order of all bit fields within the definition must be consistent.  If the first bit field is little-endian, all the remaining fields must be little-endian.  If the first bit field is big-endian, all the remaining fields must be big-endian.

Initial values to member variables are physically stored in the initial value table based on the order they are declared.  If the initial value is too large to fit in the bit field, the initial value contents are clipped to fit the size.

The variable name uniquely identifies the variable.  The name is an identifier that has not appeared earlier in the file as a construct name, an enumerated constant block name, an enumerated constant name, a member variable name, or a member function name.

An equals symbol is optional; an initializer follows the symbol if present.  The initializer follows the format described here.  If no initializer is present, the variable defaults to zero (for scalar contents) or null (for pointer contents).


  See also:  [Standard structure definitions] [Bit field structure definitions] [Derived-from-simple structure definitions]


BARfly Help Copyright © 2009 Christopher Allen