tmp/tmp79q3fpjr/{from.md → to.md}
RENAMED
|
@@ -31,13 +31,12 @@ decimal-literal:
|
|
| 31 |
hexadecimal-literal:
|
| 32 |
hexadecimal-prefix hexadecimal-digit-sequence
|
| 33 |
```
|
| 34 |
|
| 35 |
``` bnf
|
| 36 |
-
binary-digit:
|
| 37 |
-
'0'
|
| 38 |
-
'1'
|
| 39 |
```
|
| 40 |
|
| 41 |
``` bnf
|
| 42 |
octal-digit: one of
|
| 43 |
'0 1 2 3 4 5 6 7'
|
|
@@ -87,38 +86,44 @@ long-suffix: one of
|
|
| 87 |
``` bnf
|
| 88 |
long-long-suffix: one of
|
| 89 |
'll LL'
|
| 90 |
```
|
| 91 |
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
decimal values ten through fifteen.
|
| 106 |
|
| 107 |
[*Example 1*: The number twelve can be written `12`, `014`, `0XC`, or
|
| 108 |
-
`0b1100`. The integer
|
| 109 |
`0x10'0000`, and `0'004'000'000` all have the same
|
| 110 |
value. — *end example*]
|
| 111 |
|
| 112 |
-
The type of an integer
|
| 113 |
-
|
| 114 |
-
represented.
|
| 115 |
|
| 116 |
-
**Table: Types of integer
|
| 117 |
|
| 118 |
-
|
|
| 119 |
-
| ---------------- | ------------------------ | ------------------------ |
|
| 120 |
| none | `int` | `int` |
|
| 121 |
| | `long int` | `unsigned int` |
|
| 122 |
| | `long long int` | `long int` |
|
| 123 |
| | | `unsigned long int` |
|
| 124 |
| | | `long long int` |
|
|
@@ -136,16 +141,16 @@ represented.
|
|
| 136 |
| | | `unsigned long long int` |
|
| 137 |
| Both `u` or `U` | `unsigned long long int` | `unsigned long long int` |
|
| 138 |
| and `ll` or `LL` | | |
|
| 139 |
|
| 140 |
|
| 141 |
-
If an integer
|
| 142 |
-
an extended integer type
|
| 143 |
value, it may have that extended integer type. If all of the types in
|
| 144 |
-
the list for the integer
|
| 145 |
-
shall be signed. If all of the types in the list for the
|
| 146 |
-
are unsigned, the extended integer type shall be
|
| 147 |
-
contains both signed and unsigned types, the
|
| 148 |
-
be signed or unsigned. A program is ill-formed
|
| 149 |
-
units contains an integer
|
| 150 |
-
the allowed types.
|
| 151 |
|
|
|
|
| 31 |
hexadecimal-literal:
|
| 32 |
hexadecimal-prefix hexadecimal-digit-sequence
|
| 33 |
```
|
| 34 |
|
| 35 |
``` bnf
|
| 36 |
+
binary-digit: one of
|
| 37 |
+
'0 1'
|
|
|
|
| 38 |
```
|
| 39 |
|
| 40 |
``` bnf
|
| 41 |
octal-digit: one of
|
| 42 |
'0 1 2 3 4 5 6 7'
|
|
|
|
| 86 |
``` bnf
|
| 87 |
long-long-suffix: one of
|
| 88 |
'll LL'
|
| 89 |
```
|
| 90 |
|
| 91 |
+
In an *integer-literal*, the sequence of *binary-digit*s,
|
| 92 |
+
*octal-digit*s, *digit*s, or *hexadecimal-digit*s is interpreted as a
|
| 93 |
+
base N integer as shown in table [[lex.icon.base]]; the lexically first
|
| 94 |
+
digit of the sequence of digits is the most significant.
|
| 95 |
+
|
| 96 |
+
[*Note 1*: The prefix and any optional separating single quotes are
|
| 97 |
+
ignored when determining the value. — *end note*]
|
| 98 |
+
|
| 99 |
+
**Table: Base of *integer-literal*{s}** <a id="lex.icon.base">[lex.icon.base]</a>
|
| 100 |
+
|
| 101 |
+
| Kind of *integer-literal* | base $N$ |
|
| 102 |
+
| ------------------------- | -------- |
|
| 103 |
+
| *binary-literal* | 2 |
|
| 104 |
+
| *octal-literal* | 8 |
|
| 105 |
+
| *decimal-literal* | 10 |
|
| 106 |
+
| *hexadecimal-literal* | 16 |
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
The *hexadecimal-digit*s `a` through `f` and `A` through `F` have
|
| 110 |
decimal values ten through fifteen.
|
| 111 |
|
| 112 |
[*Example 1*: The number twelve can be written `12`, `014`, `0XC`, or
|
| 113 |
+
`0b1100`. The *integer-literal*s `1048576`, `1'048'576`, `0X100000`,
|
| 114 |
`0x10'0000`, and `0'004'000'000` all have the same
|
| 115 |
value. — *end example*]
|
| 116 |
|
| 117 |
+
The type of an *integer-literal* is the first type in the list in
|
| 118 |
+
[[lex.icon.type]] corresponding to its optional *integer-suffix* in
|
| 119 |
+
which its value can be represented. An *integer-literal* is a prvalue.
|
| 120 |
|
| 121 |
+
**Table: Types of *integer-literal*s** <a id="lex.icon.type">[lex.icon.type]</a>
|
| 122 |
|
| 123 |
+
| *integer-suffix* | *decimal-literal* | *integer-literal* other than *decimal-literal* |
|
| 124 |
+
| ---------------- | ------------------------ | ---------------------------------------------- |
|
| 125 |
| none | `int` | `int` |
|
| 126 |
| | `long int` | `unsigned int` |
|
| 127 |
| | `long long int` | `long int` |
|
| 128 |
| | | `unsigned long int` |
|
| 129 |
| | | `long long int` |
|
|
|
|
| 141 |
| | | `unsigned long long int` |
|
| 142 |
| Both `u` or `U` | `unsigned long long int` | `unsigned long long int` |
|
| 143 |
| and `ll` or `LL` | | |
|
| 144 |
|
| 145 |
|
| 146 |
+
If an *integer-literal* cannot be represented by any type in its list
|
| 147 |
+
and an extended integer type [[basic.fundamental]] can represent its
|
| 148 |
value, it may have that extended integer type. If all of the types in
|
| 149 |
+
the list for the *integer-literal* are signed, the extended integer type
|
| 150 |
+
shall be signed. If all of the types in the list for the
|
| 151 |
+
*integer-literal* are unsigned, the extended integer type shall be
|
| 152 |
+
unsigned. If the list contains both signed and unsigned types, the
|
| 153 |
+
extended integer type may be signed or unsigned. A program is ill-formed
|
| 154 |
+
if one of its translation units contains an *integer-literal* that
|
| 155 |
+
cannot be represented by any of the allowed types.
|
| 156 |
|