Integer literals can be decimal (base 10), hexadecimal (base 16) or octal (base 8). A decimal integer literal is a string of decimal digits. An octal literal is &O
followed by a string of octal digits. A hexadecimal literal is &H
followed by a string of hexadecimal digits. Decimal literals are always signed; octal and hexadecimal literals are always unsigned.
The type of a literal is determined by its value or by the following type character. If no type character is specified, values in the range of the Integer
type are typed as Integer
; values outside the range for Integer
are typed as Long
. Octal and hexadecimal literals are treated as a bitwise representation of a signed type for the purpose of determining type; this means that the literal &HFFFFFFFF
is typed as an Integer
, not a Long
. If an integer literal's type is at odds with the size required to hold the integer literal, an error results.
S
I
L
&
O
OctalDigit+&
H
HexDigit+0
| 1
| 2
| 3
| 4
| 5
| 6
| 7
0
| 1
| 2
| 3
| 4
| 5
| 6
| 7
| 8
| 9
0
| 1
| 2
| 3
| 4
| 5
| 6
| 7
| 8
| 9
| A
| B
| C
| D
| E
| F