Static And Extern |
|
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 Landquart | Last revised by Peter Koch, 24.02.00 | << Back Top Next >> |