18 of 172
ZBasic Language Reference 11 ZX Microcontroller Family Option Language Option Language { BasicX | ZBasic } Default: ZBasic By default the compiler processes modules using the rules and defaults for the ZBasic language. This option directive can be used to instruct the compiler to process the module using the syntax rules defined by a specific language variant. If Option Language BasicX is specified, the compiler will process the module in BasicX compatibility mode. This may be useful in certain peculiar situations if you have existing modules written for BasicX. In most cases, existing BasicX code will compile correctly in ZBasic mode with few, if any, changes. If you need to utilize BasicX compatibility mode you should be aware that none of the enhanced language features nor any of the enhanced System Library routines of ZBasic will be available in that module. Also, using Option Language BasicX changes the defaults for some of the other options as listed in the table below. You may still change the prevailing setting of these other options by utilizing the related option directive either before or after this option directive. Option Directive Default for BasicX Default for ZBasic Strict On Off AllocStr Off On This option has local scope, i.e., it only affects compilation of the module in which the option appears. Option AllocStr Option AllocStr [On | Off | Default] Default: On By default, native compilation mode uses an allocation strategy for strings called dynamic string allocation. In contrast, BasicX uses an allocation strategy called static allocation. This option directive allows you to select the dynamic allocation strategy (Option AllocStr On) or the BasicX-compatible static allocation strategy (Option AllocStr Off). Specifying Option AllocStr Default sets the option to the default for the currently selected language. If neither On, Off nor Default is specified, the value On is assumed. See Section 3.26.2 for more information on the two allocation strategies. This option has local scope, i.e., it only affects string variables defined in the same module in which the option appears. Examples Option AllocStr Option AllocStr Off Option StringSize Option StringSize {<value> | Default} Default: 20 When string variables are defined, space to hold the characters of the string is allocated either statically or dynamically. When the space is statically allocated a fixed number of bytes of space is set aside for the string at compile-time thus setting the maximum size of that string. This option specifies the number of characters that should be reserved for statically allocated string storage. See the description of the Option AllocStr directive for more information about dynamically allocated string storage. If Option StringSize Default is specified the default value for the string size is used. This is useful if the string size was set using a command line option and you want to restore it to the default for this particular module. This option has local scope, i.e., it only affects string variables defined in the same module in which the option appears.