Skip to content

Commit 60d4913

Browse files
authored
Clarify string literal length limits in docs
1 parent a59d3ff commit 60d4913

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,10 @@ const size_t byteSize = (wcslen(str) + 1) * sizeof(wchar_t);
331331

332332
Notice that `strlen()` and `wcslen()` don't include the size of the terminating null character, whose size is equal to the element size of the string type: one byte on a `char*` or `char8_t*` string, two bytes on `wchar_t*` or `char16_t*` strings, and four bytes on `char32_t*` strings.
333333

334-
In versions of Visual Studio before Visual Studio 2022 version 17.0, the maximum length of a string literal is 65,535 bytes after string concatenation. This limit applies to both narrow string literals and wide string literals. In Visual Studio 2022 version 17.0 and later, the length restriction after string concatenation is lifted, and is limited by available resources. The size limit before string concatenation remains at 16,384 bytes.
334+
Maximum length of a string literal after concatenation:
335+
336+
* Visual Studio prior to 2022 version 17.0: the maximum length of a string literal after concatenation is 65,535 bytes. This applies to both narrow and wide string literals.
337+
* From Visual Studio 2022 version 17.0 onwards: the maximum length of a string literal after concatenation is only limited by available memory. However, the size limit before concatenation is still 16,384 bytes
335338

336339
### Modifying string literals
337340

0 commit comments

Comments
 (0)