According to the manual, OCaml has 4 kinds of integer literals:
integer-literal ::= [-] (0…9) { 0…9 ∣ _ }
∣ [-] (0x ∣ 0X) (0…9 ∣ A…F ∣ a…f) { 0…9 ∣ A…F ∣ a…f ∣ _ }
∣ [-] (0o ∣ 0O) (0…7) { 0…7 ∣ _ }
∣ [-] (0b ∣ 0B) (0…1) { 0…1 ∣ _ }
int32-literal ::= integer-literal l
int64-literal ::= integer-literal L
nativeint-literal ::= integer-literal n
Inspecting the types of these literals (using utop) gives the following results:
123 : int123l : int32123L : int64123n : nativeint
The meaning of int32 and int64 is obvious enough, but what is the difference between int and nativeint, and how do they relate to the explicitly sized 32/64 bit ints?