Go to the first, previous, next, last section, table of contents.

### 4.13.1 Integer Constants

Larch/C++ integer constants are exactly the sames as those of C++. See section 4.6 Identifiers for the lexical syntax of `digit`.

```integer-constant  ::= decimal-constant | octal-constant | hex-constant
decimal-constant ::= one-to-nine [ digit ] ... [integer-suffix]
one-to-nine      ::= `1` | `2` | `3` | `4` | `5` | `6` | `7` | `8` | `9`
octal-constant   ::= `0` [ octal-digit ] ... [integer-suffix]
octal-digit      ::= `0` | `1` | `2` | `3` | `4` | `5` | `6` | `7`
hex-constant     ::= `0` hex-indicator hex-digit [ hex-digit ] ... [integer-suffix]
hex-indicator    ::= `x` | `X`
hex-digit        ::= digit | `a` | `b` | `c` | `d` | `e` | `f` | `A` | `B` | `C` | `D` | `E` | `F`
integer-suffix   ::= long-suffix | unsigned-suffix
| long-suffix unsigned-suffix | unsigned-suffix long-suffix
long-suffix ::= `l` | `L`
unsigned-suffix ::= `u` | `U`
```

Some examples of integer-constants follow.

```227
228U
0342L
0xFFFFFFFFul
```

The meaning of an integer-constant is as in C++ (See Section 2.5.1 of [Ellis-Stroustrup90]), except that the sort of an integer-constant is always `int`, unless a suffix is present. This makes the specification independent of a particular C++ implementation of integers.

Go to the first, previous, next, last section, table of contents.