BARfly Help - BAR Implementation File Reference - Structure Scope

  Derived-from-simple structure definitions

DerivedFromSimpleStructureDefinition ::= EnumeratedTypeAssociation?

When a structure is derived from simple type, the definition is limited to only an optional enumerated type association.

EnumeratedTypeAssociation ::= ‘enum’ S? ‘=’ S? EnumeratedConstantBlockName S? ‘;’

The enumerated constant block that used EnumeratedConstantBlockName must have been declared earlier in the file.

It can sometimes be useful to associate a type with an enumerated constant block’s constants.  There is a reason enumerated type associations occur this way in BAR, and not using ‘enum’ itself as a variable type specifier in the variable declaration, as many languages do.  BAR requires that both enumerated type association and size be known, while many languages force the size of an enumerated type-based variable to that of a default word size.


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


BARfly Help Copyright © 2009 Christopher Allen