Navigation: Language Reference > 3 - Variable Declarations > Data Types >====== SHORT (two-byte signed integer) ====== | |
label SHORT([initial value]) [,DIM( )] [,OVER( )] [,NAME( )] [,EXTERNAL] [,DLL] [,STATIC] | |
[,THREAD] [,AUTO] [,PRIVATE] [,PROTECTED] |
SHORT | A two-byte signed integer. |
Format: ± magnitude
| . | ………. |
Bits: 15 14 0
Range: -32,768 to 32,767
initial value | A numeric constant. If omitted, the initial value is zero, unless the AUTO attribute is present. |
DIM | Dimension the variable as an array. |
OVER | Share a memory location with another variable. |
NAME | Specify an alternate, “external” name for the field. |
EXTERNAL | Specify the variable is defined, and its memory is allocated, in an external library. Not valid within FILE, QUEUE, or GROUP declarations. |
DLL | Specify the variable is defined in a .DLL. This is required in addition to the EXTERNAL attribute. |
STATIC | Specify the variable's memory is permanently allocated. |
THREAD | Specify memory for the variable is allocated once for each execution thread. Also implicitly adds the STATIC attribute on Procedure Local data. |
AUTO | Specify the variable has no initial value. |
PRIVATE | Specify the variable is not visible outside the module containing the CLASS methods. Valid only in a CLASS. |
PROTECTED | Specify the variable is not visible outside base CLASS and derived CLASS methods. Valid only in a CLASS. |
SHORT declares a two-byte signed integer, using the Intel 8086 word integer format. The high-order bit of this configuration is the sign bit (0 = positive, 1 = negative). Negative values are represented in standard two's complement notation.
Example:
Count1 SHORT !Declare two-byte signed integer
Count2 SHORT,OVER(Count1) !Declare OVER the two-byte signed integer
Count3 SHORT,DIM(4) !Declare it an array of 4 shorts
Count4 SHORT(5) !Declare with initial value
Count5 SHORT,EXTERNAL !Declare as external
Count6 SHORT,EXTERNAL,DLL !Declare as external in a .DLL
Count7 SHORT,NAME('SixCount') !Declare with external name
ExampleFile FILE,DRIVER('Clarion') !Declare a file
Record RECORD
Count7 SHORT,NAME('Counter') !Declare with external name
END
END