From a0b62f1257fac99bc30ac7cd4e059bf02260e189 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Sun, 24 Jul 2022 18:41:22 +0700 Subject: [PATCH 1/2] Visual C++ 17.0 has unlimited string literals --- docs/cpp/string-and-character-literals-cpp.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/cpp/string-and-character-literals-cpp.md b/docs/cpp/string-and-character-literals-cpp.md index 561a75d272..b640b95448 100644 --- a/docs/cpp/string-and-character-literals-cpp.md +++ b/docs/cpp/string-and-character-literals-cpp.md @@ -331,7 +331,8 @@ const size_t byteSize = (wcslen(str) + 1) * sizeof(wchar_t); 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. -The maximum length of a string literal is 65,535 bytes. This limit applies to both narrow string literals and wide string literals. +The maximum length of a string literal was 65,535 bytes. This limit applied to both narrow string literals and wide string literals. +This limit was removed in VS 2022 17.0 GA. ### Modifying string literals From 1020b7b35fb755be2cd85b5f2446c69e495f8bd4 Mon Sep 17 00:00:00 2001 From: Colin Robertson <3836425+corob-msft@users.noreply.github.com> Date: Thu, 4 Aug 2022 17:57:26 -0700 Subject: [PATCH 2/2] Update for consistent branding. --- docs/cpp/string-and-character-literals-cpp.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/cpp/string-and-character-literals-cpp.md b/docs/cpp/string-and-character-literals-cpp.md index b640b95448..7e4437779b 100644 --- a/docs/cpp/string-and-character-literals-cpp.md +++ b/docs/cpp/string-and-character-literals-cpp.md @@ -331,8 +331,7 @@ const size_t byteSize = (wcslen(str) + 1) * sizeof(wchar_t); 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. -The maximum length of a string literal was 65,535 bytes. This limit applied to both narrow string literals and wide string literals. -This limit was removed in VS 2022 17.0 GA. +In versions of Visual Studio before Visual Studio 2022 version 17.0, the maximum length of a string literal is 65,535 bytes. This limit applies to both narrow string literals and wide string literals. In Visual Studio 2022 version 17.0 and later, this restriction is lifted and string length is limited by available resources. ### Modifying string literals