Integer literals
The long long features
There are two long long features:
- the C99 long long feature
- the non-C99 long long feature
Note: The syntax of integer literals is the same for
both of the long long features.
Types of integer literals that are supported in pre-C99 and pre-C++11 modes
The following table
lists the integer literals and shows the possible data types when
the C99 long long feature is not enabled.
| Representation | Suffix | Possible data types | |||||
|---|---|---|---|---|---|---|---|
| int | unsigned int | long int | unsigned long int | ![]() |
![]() |
||
| Decimal | None | + | + | +2 | |||
| Octal, Hex | None | + | + | + | + | ||
| All | u or U | + | + | ||||
| Decimal | l or L | + | + | ||||
| Octal, Hex | l or L | + | + | ||||
| All | Both u or U and l or L | + | |||||
| Decimal | ll or LL | + | + | ||||
| Octal, Hex | ll or LL | + | + | ||||
| All | Both u or U and ll or LL | + | |||||
Note:
|
|||||||
Types of integer literals that are supported in C99 and C++11
When both the C99 and non-C99 long long features are disabled, integer literals that have
one of the following suffixes cause a severe compile-time error:
- ll or LL
- Both u or U and ll or LL
To strictly conform to
the C++11 standard, the compiler introduces the extended integer safe
behavior to ensure that a signed value never becomes an unsigned value
after a promotion. After you enable this behavior, if a decimal integer
literal that does not have a suffix containing u or U cannot be represented by the long long int type, the compiler issues a warning message to indicate
that the value of the literal is out of range. You can change the severity of the message from warning
to error with the -Werror=implicitly-unsigned-literal option. The extended integer safe behavior is the only difference
between the C99 long long feature with the associated IBM extensions
and the C99 long long feature.
The following table lists the integer literals and shows the
possible data types when the C99 long long feature
is enabled.
| Representation | Suffix | Possible data types | |||||
|---|---|---|---|---|---|---|---|
| int | unsigned int | long int | unsigned long int | long long int | unsigned long long int | ||
| Decimal | None | + | + | +1, 2 | |||
| Octal, Hex | None | + | + | + | + | ||
| All | u or U | + | + | ||||
| Decimal | l or L | + | +1, 2 | ||||
| Octal, Hex | l or L | + | + | ||||
| All | Both u or U and l or L | + | |||||
| Decimal | ll or LL | + | +1, 2 | ||||
| Octal, Hex | ll or LL | + | + | ||||
| All | Both u or U and ll or LL | + | |||||
Note:
|
|||||||



