
A6.6 External declarations 133
An Ox program consists of a sequence of external declarations. These either reserve
storage for an object, or serve to inform of the existence of objects created elsewhere.
A6.6.1 External statement
external-statement:
external type variable-list ;
variable-list:
identifier
variable-list , identifier
The external variable declaration list makes externally created variables available to
the remainder of the source file. Such variables are not created through the external
statement, but just pulled into the current scope. The type is defined in §A6.4.1.
A6.6.2 Declare statement
declare-statement:
declare declare-ident-list ;
declare matrix declare-ident-list ;
declare string declare-ident-list ;
declare-ident-list:
identifier initialisation
opt
declare-ident-list , identifier initialisation
opt
initialisation:
dimension
opt
initial-value
dimension:
[ int-constant-expression , int-constant-expression ]
[ int-constant-expression]
initial-value:
assign scalar-constant
assign matrix-constant
assign vector-constant
assign string-constant
assign one of:
=!=:=?=
The declare statement creates storage space for a variable. If no type is specified,
the type is matrix. If no initialisation is specified, the variable is set to zero (or an
empty string if the type is string). Constants and constant expressions are explained
in §A6.3.
The dimension can only be specified for matrix type. If a dimension is specified
as well as a matrix constant for initialization, they must match in dimension (this is not
enforced: the constant takes precedence
∗
). If a dimension is specified together with a
scalar initial value, all elements are set to that value. If an external variable is created
Comentários a estes Manuais