Long integers (&)

Like regular Integers, Long integers cannot contain decimal points.  However, they span a much greater range, from -2,147,483,648 to +2,147,483,647  ( -2^31 to 2^31 - 1) yet occupy just 4 bytes (32-bits).  The type-specifier character for a Long integer is: &.

Long integers are identified by following the variable name with an ampersand (i.e., var&) or by using the DEFLNG statement as described in the previous discussion of Integers.  You can also declare Long-integer variables using the LONG keyword with the DIM statement.  For example:

DIM I AS LONG

Long integers are the most efficient numeric data type in PowerBASIC and should be used in all cases where speed is important and a greater numeric range is not required.  (Using Byte and Integer variables in FOR/NEXT loops is actually slower than using a Long integer.)

A PowerBASIC Long-integer variable is equivalent to the BOOL data type (in capital letters) commonly used by C/C++ compilers.  Note that a bool (lowercase) is a non-traditional data type, equivalent to a Byte in PowerBASIC.  Be aware that some older C compilers may freely interchange bool and BOOL keywords.

A C/C++ int and a Delphi longint variable are also equivalent to a PowerBASIC Long integer.

 

See Also

Byte (?)

Double-word (???)

Integers (%)

Quad integers (&&)

Word (??)