tmp/tmpdjivcaw5/{from.md → to.md}
RENAMED
|
@@ -27,13 +27,11 @@ decimal-literal:
|
|
| 27 |
decimal-literal '''ₒₚₜ digit
|
| 28 |
```
|
| 29 |
|
| 30 |
``` bnf
|
| 31 |
hexadecimal-literal:
|
| 32 |
-
|
| 33 |
-
'0X' hexadecimal-digit
|
| 34 |
-
hexadecimal-literal '''ₒₚₜ hexadecimal-digit
|
| 35 |
```
|
| 36 |
|
| 37 |
``` bnf
|
| 38 |
binary-digit:
|
| 39 |
'0'
|
|
@@ -48,10 +46,21 @@ octal-digit: one of
|
|
| 48 |
``` bnf
|
| 49 |
nonzero-digit: one of
|
| 50 |
'1 2 3 4 5 6 7 8 9'
|
| 51 |
```
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
``` bnf
|
| 54 |
hexadecimal-digit: one of
|
| 55 |
'0 1 2 3 4 5 6 7 8 9'
|
| 56 |
'a b c d e f'
|
| 57 |
'A B C D E F'
|
|
@@ -82,22 +91,25 @@ long-long-suffix: one of
|
|
| 82 |
|
| 83 |
An *integer literal* is a sequence of digits that has no period or
|
| 84 |
exponent part, with optional separating single quotes that are ignored
|
| 85 |
when determining its value. An integer literal may have a prefix that
|
| 86 |
specifies its base and a suffix that specifies its type. The lexically
|
| 87 |
-
first digit of the sequence of digits is the most significant. A
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
*hexadecimal
|
| 94 |
and consists of a sequence of hexadecimal digits, which include the
|
| 95 |
decimal digits and the letters `a` through `f` and `A` through `F` with
|
| 96 |
-
decimal values ten through fifteen.
|
| 97 |
-
|
| 98 |
-
`
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
The type of an integer literal is the first of the corresponding list in
|
| 101 |
Table [[tab:lex.type.integer.literal]] in which its value can be
|
| 102 |
represented.
|
| 103 |
|
|
@@ -127,13 +139,13 @@ represented.
|
|
| 127 |
|
| 128 |
|
| 129 |
If an integer literal cannot be represented by any type in its list and
|
| 130 |
an extended integer type ([[basic.fundamental]]) can represent its
|
| 131 |
value, it may have that extended integer type. If all of the types in
|
| 132 |
-
the list for the literal are signed, the extended integer type
|
| 133 |
-
signed. If all of the types in the list for the
|
| 134 |
-
the extended integer type shall be unsigned. If the list
|
| 135 |
-
signed and unsigned types, the extended integer type may
|
| 136 |
-
unsigned. A program is ill-formed if one of its translation
|
| 137 |
-
contains an integer literal that cannot be represented by any of
|
| 138 |
-
allowed types.
|
| 139 |
|
|
|
|
| 27 |
decimal-literal '''ₒₚₜ digit
|
| 28 |
```
|
| 29 |
|
| 30 |
``` bnf
|
| 31 |
hexadecimal-literal:
|
| 32 |
+
hexadecimal-prefix hexadecimal-digit-sequence
|
|
|
|
|
|
|
| 33 |
```
|
| 34 |
|
| 35 |
``` bnf
|
| 36 |
binary-digit:
|
| 37 |
'0'
|
|
|
|
| 46 |
``` bnf
|
| 47 |
nonzero-digit: one of
|
| 48 |
'1 2 3 4 5 6 7 8 9'
|
| 49 |
```
|
| 50 |
|
| 51 |
+
``` bnf
|
| 52 |
+
hexadecimal-prefix: one of
|
| 53 |
+
'0x 0X'
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
``` bnf
|
| 57 |
+
hexadecimal-digit-sequence:
|
| 58 |
+
hexadecimal-digit
|
| 59 |
+
hexadecimal-digit-sequence '''ₒₚₜ hexadecimal-digit
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
``` bnf
|
| 63 |
hexadecimal-digit: one of
|
| 64 |
'0 1 2 3 4 5 6 7 8 9'
|
| 65 |
'a b c d e f'
|
| 66 |
'A B C D E F'
|
|
|
|
| 91 |
|
| 92 |
An *integer literal* is a sequence of digits that has no period or
|
| 93 |
exponent part, with optional separating single quotes that are ignored
|
| 94 |
when determining its value. An integer literal may have a prefix that
|
| 95 |
specifies its base and a suffix that specifies its type. The lexically
|
| 96 |
+
first digit of the sequence of digits is the most significant. A *binary
|
| 97 |
+
integer literal* (base two) begins with `0b` or `0B` and consists of a
|
| 98 |
+
sequence of binary digits. An *octal integer literal* (base eight)
|
| 99 |
+
begins with the digit `0` and consists of a sequence of octal
|
| 100 |
+
digits.[^12] A *decimal integer literal* (base ten) begins with a digit
|
| 101 |
+
other than `0` and consists of a sequence of decimal digits. A
|
| 102 |
+
*hexadecimal integer literal* (base sixteen) begins with `0x` or `0X`
|
| 103 |
and consists of a sequence of hexadecimal digits, which include the
|
| 104 |
decimal digits and the letters `a` through `f` and `A` through `F` with
|
| 105 |
+
decimal values ten through fifteen.
|
| 106 |
+
|
| 107 |
+
[*Example 1*: The number twelve can be written `12`, `014`, `0XC`, or
|
| 108 |
+
`0b1100`. The integer literals `1048576`, `1'048'576`, `0X100000`,
|
| 109 |
+
`0x10'0000`, and `0'004'000'000` all have the same
|
| 110 |
+
value. — *end example*]
|
| 111 |
|
| 112 |
The type of an integer literal is the first of the corresponding list in
|
| 113 |
Table [[tab:lex.type.integer.literal]] in which its value can be
|
| 114 |
represented.
|
| 115 |
|
|
|
|
| 139 |
|
| 140 |
|
| 141 |
If an integer literal cannot be represented by any type in its list and
|
| 142 |
an extended integer type ([[basic.fundamental]]) can represent its
|
| 143 |
value, it may have that extended integer type. If all of the types in
|
| 144 |
+
the list for the integer literal are signed, the extended integer type
|
| 145 |
+
shall be signed. If all of the types in the list for the integer literal
|
| 146 |
+
are unsigned, the extended integer type shall be unsigned. If the list
|
| 147 |
+
contains both signed and unsigned types, the extended integer type may
|
| 148 |
+
be signed or unsigned. A program is ill-formed if one of its translation
|
| 149 |
+
units contains an integer literal that cannot be represented by any of
|
| 150 |
+
the allowed types.
|
| 151 |
|