Static And Extern

C Styled Script
Reference Manual

<< Back  End  Next >>
 
 
INDEX
Introduction
Installation
Using The CSS Executive
Language
   Comments
   Literals
   Var And Const
      Arrays
      Initialization
      Static And Extern
      Dynamic Relocation
   Operators
   Statements And blocks
   Program Flow
   Exception Handling
   Functions
   Predefined Identifiers
Directives
System Library
String Library
Regular Expression Lib.
File Library
Database Library
C API
C++ API
CSS Links
  

Global identifiers may be prefixed by static or extern:

static var max = 100;

Static globals as max are visible only to the module they are defined in. Unlike C/C++, static's may not be defined within functions.

extern const size;

Since size is defined external there is no initializer allowed in this context. In fact you can use extern also as forward declaration for an identifier declared later in the same module. As long as the value of size is unknown you cannot use it as index when defining a global array. However you may use it to define arrays within functions:

var zz[size]; // illegal, unknown at compile time
 
var bee(var y)
{
  var kk[y][size]; // ok, allocated at runtime
} // bee

External declarations are necessary when using identifiers that are loaded at runtime (see sysLoadScript and sysLoadLibrary). Usually you will have the external definitions in a .hss file bound in by#include or #loadScript. Identifiers loaded at compile-time need no forward declaration if they are loaded before use.

 Copyright © IBK LandquartLast revised by Peter Koch, 24.02.00<< Back  Top  Next >>