BARfly Help - BAR Implementation File Reference - File Scope

  Global Variable Declarations

Global variables (and their initial values) are physically stored in the initial value table based on the order they are declared.

GlobalVariableDeclarations ::= (DataStructureType | ‘void’) S VariableDeclaration (S? ‘,’ S? VariableDeclaration)* S? ‘;’

The variable type identifies the base type of the variable.  The type is either a keyword representing one of the built-in simple types (void, char, short, long, longlong, float, or double) or an identifier for a data structure name.  If the void type is used, an asterisk is required to qualify the type as a void pointer.

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 global variable name, or a global function name.

If brackets appear following the variable name, this identifies the variable as an array of the given type (or array-of-pointer to the given type, if an asterisk appeared).

If only one set of brackets appears, the array has one dimension.  The element count inside the brackets must be a valid constant.  If the element count is left out, an initializer must appear (because the array is implicitly sized).

If two sets of brackets appear, the array has two dimensions.  Both element counts must be present within the brackets, and both valid constants.

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:  [Global variable declarations] [Global function declarations] [Enumerated constant block declarations]
[Structure declarations] [Block declarations] [List declarations]


BARfly Help Copyright © 2009 Christopher Allen