Skip to content

Commit 332a5a3

Browse files
Merge pull request #5032 from MicrosoftDocs/main638506998462533083sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents 7d522a1 + 04f1a24 commit 332a5a3

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

docs/cpp/char-wchar-t-char16-t-char32-t.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
description: "Learn more about: char, wchar_t, char8_t, char16_t, char32_t"
33
title: "char, wchar_t, char8_t, char16_t, char32_t"
44
ms.date: 04/23/2021
5-
ms.assetid: 6b33e9f5-455b-4e49-8f12-a150cbfe2e5b
65
---
76
# char, wchar_t, char8_t, char16_t, char32_t
87

9-
The types **`char`**, **`wchar_t`**, **`char8_t`**, **`char16_t`**, and **`char32_t`** are built-in types that represent alphanumeric characters, non-alphanumeric glyphs, and non-printing characters.
8+
The types **`char`**, **`wchar_t`**, **`char8_t`**, **`char16_t`**, and **`char32_t`** are built-in types that represent alphanumeric characters, nonalphanumeric glyphs, and nonprinting characters.
109

1110
## Syntax
1211

@@ -19,12 +18,14 @@ char32_t ch4{ U'a' };
1918
2019
## Remarks
2120
22-
The **`char`** type was the original character type in C and C++. The **`char`** type can be used to store characters from the ASCII character set or any of the ISO-8859 character sets, and individual bytes of multi-byte characters such as Shift-JIS or the UTF-8 encoding of the Unicode character set. In the Microsoft compiler, **`char`** is an 8-bit type. It's a distinct type from both **`signed char`** and **`unsigned char`**. By default, variables of type **`char`** get promoted to **`int`** as if from type **`signed char`** unless the [`/J`](../build/reference/j-default-char-type-is-unsigned.md) compiler option is used. Under **`/J`**, they're treated as type **`unsigned char`** and get promoted to **`int`** without sign extension.
21+
The **`char`** type was the original character type in C and C++. The **`char`** type stores characters from the ASCII character set or any of the ISO-8859 character sets, and individual bytes of multi-byte characters such as Shift-JIS or the UTF-8 encoding of the Unicode character set. In the Microsoft compiler, **`char`** is an 8-bit type. It's a distinct type from both **`signed char`** and **`unsigned char`**. By default, variables of type **`char`** get promoted to **`int`** as if from type **`signed char`** unless the [`/J`](../build/reference/j-default-char-type-is-unsigned.md) compiler option is used. Under **`/J`**, they're treated as type **`unsigned char`** and get promoted to **`int`** without sign extension.
2322
2423
The type **`unsigned char`** is often used to represent a *byte*, which isn't a built-in type in C++.
2524
2625
The **`wchar_t`** type is an implementation-defined wide character type. In the Microsoft compiler, it represents a 16-bit wide character used to store Unicode encoded as UTF-16LE, the native character type on Windows operating systems. The wide character versions of the Universal C Runtime (UCRT) library functions use **`wchar_t`** and its pointer and array types as parameters and return values, as do the wide character versions of the native Windows API.
2726
2827
The **`char8_t`**, **`char16_t`**, and **`char32_t`** types represent 8-bit, 16-bit, and 32-bit wide characters, respectively. (**`char8_t`** is new in C++20 and requires the [`/std:c++20`](../build/reference/std-specify-language-standard-version.md) or **`/std:c++latest`** compiler option.) Unicode encoded as UTF-8 can be stored in the **`char8_t`** type. Strings of **`char8_t`** and **`char`** type are referred to as *narrow* strings, even when used to encode Unicode or multi-byte characters. Unicode encoded as UTF-16 can be stored in the **`char16_t`** type, and Unicode encoded as UTF-32 can be stored in the **`char32_t`** type. Strings of these types and **`wchar_t`** are all referred to as *wide* strings, though the term often refers specifically to strings of **`wchar_t`** type.
2928
30-
In the C++ standard library, the `basic_string` type is specialized for both narrow and wide strings. Use `std::string` when the characters are of type **`char`**, `std::u8string` when the characters are of type **`char8_t`**, `std::u16string` when the characters are of type **`char16_t`**, `std::u32string` when the characters are of type **`char32_t`**, and `std::wstring` when the characters are of type **`wchar_t`**. Other types that represent text, including `std::stringstream` and `std::cout` have specializations for narrow and wide strings.
29+
In the C++ standard library, the [`basic_string`](/cpp/standard-library/basic-string-class) type is specialized for both narrow and wide strings. Use `std::string` when the characters are of type **`char`**, `std::u8string` when the characters are of type **`char8_t`**, `std::u16string` when the characters are of type **`char16_t`**, `std::u32string` when the characters are of type **`char32_t`**, and `std::wstring` when the characters are of type **`wchar_t`**.
30+
31+
Other types that represent text, including [`std::stringstream`](/cpp/standard-library/sstream-typedefs/#stringstream) and [`std::cout`](/cpp/standard-library/iostream#cout) have specializations for narrow and wide strings.

docs/error-messages/compiler-errors-2/compiler-errors-c3300-through-c3399.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
description: "Learn more about: Compiler errors C3300 Through C3399"
3-
title: "Compiler errors C3300 Through C3399"
3+
title: "Compiler errors C3300 through C3399"
44
ms.date: 06/01/2022
55
f1_keywords: ["C3300", "C3301", "C3302", "C3304", "C3305", "C3306", "C3307", "C3308", "C3310", "C3311", "C3312", "C3313", "C3314", "C3315", "C3316", "C3317", "C3318", "C3319", "C3321", "C3323", "C3324", "C3325", "C3326", "C3327", "C3328", "C3329", "C3330", "C3331", "C3332", "C3335", "C3336", "C3337", "C3338", "C3339", "C3341", "C3343", "C3344", "C3346", "C3348", "C3349", "C3355", "C3357", "C3359", "C3361", "C3362", "C3376", "C3377", "C3378"]
66
helpviewer_keywords: ["C3300", "C3301", "C3302", "C3304", "C3305", "C3306", "C3307", "C3308", "C3310", "C3311", "C3312", "C3313", "C3314", "C3315", "C3316", "C3317", "C3318", "C3319", "C3321", "C3323", "C3324", "C3325", "C3326", "C3327", "C3328", "C3329", "C3330", "C3331", "C3332", "C3335", "C3336", "C3337", "C3338", "C3339", "C3341", "C3343", "C3344", "C3346", "C3348", "C3349", "C3355", "C3357", "C3359", "C3361", "C3362", "C3376", "C3377", "C3378"]
7-
ms.assetid: 190b7d29-ffe6-4261-921d-140da1935d00
87
---
98
# Compiler errors C3300 Through C3399
109

@@ -17,24 +16,24 @@ The articles in this section of the documentation explain a subset of the error
1716
| Error | Message |
1817
|--|--|
1918
| Compiler error C3300 | '*symbol*': improper format for IDL '*value*' |
20-
| Compiler error C3301 | '*coclass*': coclass cannot be a '*symbol*' interface |
19+
| Compiler error C3301 | '*coclass*': `coclass` cannot be a '*symbol*' interface |
2120
| Compiler error C3302 | '*identifier*': identifier has more than *number* characters |
2221
| [Compiler error C3303](compiler-error-c3303.md) | '*attribute*': attribute can only be used on '*type*' |
2322
| Compiler error C3304 | Obsolete. |
2423
| Compiler error C3305 | Obsolete. |
2524
| Compiler error C3306 | '*template*': unnamed class template/generic is not allowed |
2625
| Compiler error C3307 | '*module*': unable to create IDL module |
27-
| Compiler error C3308 | ' *function*': direct call through imported class is not supported |
26+
| Compiler error C3308 | '*function*': direct call through imported class is not supported |
2827
| [Compiler error C3309](compiler-error-c3309.md) | '*macro*/*keyword*': module name cannot be a macro or a keyword |
2928
| Compiler error C3310 | '*identifier*': module name conflict |
3029
| Compiler error C3311 | module attribute must be defined at global scope |
3130
| Compiler error C3312 | no callable '*identifier*' function found for type '*type*' |
3231
| Compiler error C3313 | '*identifier*': variable cannot have the type '*type*' |
3332
| Compiler error C3314 | '*symbol*': not a supported IDL module type |
34-
| Compiler error C3315 | ' *function*': must be a member function |
33+
| Compiler error C3315 | '*function*': must be a member function |
3534
| Compiler error C3316 | '*type*': an array of unknown size cannot be used in a range-based for statement |
3635
| Compiler error C3317 | '*identifier*': an overload function cannot be used as the expression in a range-based for statement |
37-
| Compiler error C3318 | '*type*': an array cannot have an element type that contains 'auto' |
36+
| Compiler error C3318<sup>1</sup> | '*type*': an array cannot have an element type that contains '`auto`'|
3837
| Compiler error C3319 | Obsolete. |
3938
| [Compiler error C3320](compiler-error-c3320.md) | '*type*': type cannot have the same name as the module 'name' property |
4039
| Compiler error C3321 | an initializer list is unexpected in this context |
@@ -55,7 +54,7 @@ The articles in this section of the documentation explain a subset of the error
5554
| Compiler error C3336 | This operation must be performed at class scope |
5655
| Compiler error C3337 | '*identifier*': defaultvtable must be an event source for a coclass '*class*' |
5756
| Compiler error C3338 | '*identifier*': There can be at most one default interface that is also an event source for a coclass '*class*' |
58-
| Compiler error C3339 | template template parameter requires either 'class' or 'typename' after the parameter list |
57+
| Compiler error C3339 | template parameter requires either 'class' or 'typename' after the parameter list |
5958
| [Compiler error C3340](compiler-error-c3340.md) | '*identifier*': interface cannot be both 'restricted' and 'default' in coclass '*class*' |
6059
| Compiler error C3341 | '*interface*': a defaultvtable interface must be either 'dual' or 'custom' |
6160
| [Compiler error C3342](compiler-error-c3342.md) | '*identifier*': ambiguous attribute |
@@ -66,8 +65,8 @@ The articles in this section of the documentation explain a subset of the error
6665
| [Compiler error C3347](compiler-error-c3347.md) | '*argument*': required argument is not specified in attribute *attribute-name* |
6766
| Compiler error C3348 | exported templates are not part of the current C++ standards |
6867
| Compiler error C3349 | '*class*::*member*': multicast attribute has already been implemented by provider *provider-name* |
69-
| [Compiler error C3350](compiler-error-c3350.md) | ' *function*': a delegate constructor expects *number* argument(s) |
70-
| [Compiler error C3351](compiler-error-c3351.md) | ' *function*': if you pass a NULL object instance to a delegate constructor you must also pass the address of a static member function |
68+
| [Compiler error C3350](compiler-error-c3350.md) | '*function*': a delegate constructor expects *number* argument(s) |
69+
| [Compiler error C3351](compiler-error-c3351.md) | '*function*': if you pass a NULL object instance to a delegate constructor you must also pass the address of a static member function |
7170
| [Compiler error C3352](compiler-error-c3352.md) | '*function*': the specified function does not match the delegate type '*type*' |
7271
| [Compiler error C3353](compiler-error-c3353.md) | '*identifier*': a delegate can only be created from a global function or a member function of a managed/WinRT type |
7372
| [Compiler error C3354](compiler-error-c3354.md) | '*identifier*': the function used to create a delegate cannot have return type '*type*' |
@@ -117,6 +116,8 @@ The articles in this section of the documentation explain a subset of the error
117116
| [Compiler error C3398](compiler-error-c3398.md) | '*operator*': cannot convert from '*type*' to '*type*'. Source expression must be a function symbol |
118117
| [Compiler error C3399](compiler-error-c3399.md) | '*type*': cannot provide arguments when creating an instance of a generic parameter |
119118

119+
1-No longer emitted in Visual Studio 2022 version 17.11
120+
120121
## See also
121122

122123
[C/C++ Compiler and build tools errors and warnings](../compiler-errors-1/c-cpp-build-errors.md) \

0 commit comments

Comments
 (0)