Skip to content

Commit 20ed2d0

Browse files
author
Colin Robertson
committed
Distinguishing MS-specific stuff even more
1 parent 1494e42 commit 20ed2d0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/cpp/string-and-character-literals-cpp.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ There are three kinds of escape sequences: simple, octal, and hexadecimal. Escap
109109
| alert (bell) | \\a |
110110
| hexadecimal | \\xhhh |
111111

112-
An octal escape sequence is a backslash followed by a sequence of one to three octal digits. An octal escape sequence terminates at the first character that's not an octal digit, if encountered sooner than the third digit, and warning C4125 is generated if the character is a decimal digit. The highest possible octal value is `\377`. An octal escape sequence that has a higher value causes error C2022: '*value-in-decimal*': too big for character.
112+
An octal escape sequence is a backslash followed by a sequence of one to three octal digits. An octal escape sequence terminates at the first character that's not an octal digit, if encountered sooner than the third digit. The highest possible octal value is `\377`.
113113

114-
A hexadecimal escape sequence is a backslash followed by the character `x`, followed by a sequence of hexadecimal digits. An escape sequence that contains no hexadecimal digits causes compiler error C2153: "hex literals must have at least one hex digit". Leading zeroes are ignored. In an ordinary or u8-prefixed character literal, the highest hexadecimal value is 0xFF. In an L-prefixed or u-prefixed wide character literal, the highest hexadecimal value is 0xFFFF. In a U-prefixed wide character literal, the highest hexadecimal value is 0xFFFFFFFF.
114+
A hexadecimal escape sequence is a backslash followed by the character `x`, followed by a sequence of one or more hexadecimal digits. Leading zeroes are ignored. In an ordinary or u8-prefixed character literal, the highest hexadecimal value is 0xFF. In an L-prefixed or u-prefixed wide character literal, the highest hexadecimal value is 0xFFFF. In a U-prefixed wide character literal, the highest hexadecimal value is 0xFFFFFFFF.
115115

116116
This sample code shows some examples of escaped characters using ordinary character literals. The same escape sequence syntax is valid for the other character literal types.
117117

@@ -154,17 +154,17 @@ char c1 = '\100'; // '@'
154154
char c2 = '\1000'; // C4305, C4309, truncates to '0'
155155
```
156156

157-
Escape sequences that appear to contain non-octal characters are evaluated as an octal sequence up to the last octal character, followed by the remaining characters as characters in a multicharacter literal. Warning C4125 is generated if the first non-octal character is a decimal digit. For example:
157+
Escape sequences that appear to contain non-octal characters are evaluated as an octal sequence up to the last octal character, followed by the remaining characters as the subsequent characters in a multicharacter literal. Warning C4125 is generated if the first non-octal character is a decimal digit. For example:
158158

159159
```cpp
160160
char c3 = '\009'; // '9'
161161
char c4 = '\089'; // C4305, C4309, truncates to '9'
162162
char c5 = '\qrs'; // C4129, C4305, C4309, truncates to 's'
163163
```
164164

165-
The highest possible octal value is `\377`. An octal escape sequence that has a higher value causes error C2022: '*value-in-decimal*': too big for character.
165+
An octal escape sequence that has a higher value than `\377` causes error C2022: '*value-in-decimal*': too big for character.
166166

167-
An escape sequence that appears to have hexadecimal and non-hexadecimal characters is evaluated as a multicharacter literal that contains a hexadecimal escape sequence up to the last hexadecimal character, followed by the non-hexadecimal characters.
167+
An escape sequence that appears to have hexadecimal and non-hexadecimal characters is evaluated as a multicharacter literal that contains a hexadecimal escape sequence up to the last hexadecimal character, followed by the non-hexadecimal characters. A hexadecimal escape sequence that contains no hexadecimal digits causes compiler error C2153: "hex literals must have at least one hex digit".
168168

169169
```cpp
170170
char c6 = '\x0050'; // 'P'

0 commit comments

Comments
 (0)