6. Embedded QUEL for BASIC : BASIC Variables and Data Types : Variable and Type Declarations : The Integer Data Type
 
Share this page                  
The Integer Data Type
All BASIC integer data type sizes are accepted by the preprocessor. It is important that the preprocessor knows about integer size, because it generates code to load data in and out of program variables. EQUEL assumes that integer size is four bytes by default. However, you may inform EQUEL of a non-default integer size by using the -i flag on the preprocessor command line. (For more information, see Precompiling, Compiling, and Linking an EQUEL Program.)
For example, the preprocessor command:
$ eqb -i2 myfile.qb
causes the preprocessor to treat all variables of type integer as two-byte quantities. If you use the -i flag, be sure to inform the BASIC compiler of the integer size, either by means of an option to the basic command or, in the program, by means of the BASIC options statement.
You can explicitly override the default or the preprocessor -i size by using the BASIC subtype words byte, word or long in the variable declaration, as these examples illustrate:
##   declare byte one_byte_int
##   common (globals) word two_byte_int
##   external long four_byte_int
These declarations create EQUEL integer variables of one, two, and four bytes, respectively, regardless of the default setting.
An integer variable can be used with any numeric-valued object to assign or receive numeric data. For example, such a variable can be used to set a field in a form or to retrieve a column from a database table.