Skip to content

Commit b18a985

Browse files
author
Colin Robertson
authored
Merge pull request #3061 from MicrosoftDocs/master637526360644240500
Repo sync for protected CLA branch
2 parents ef17457 + a040b6a commit b18a985

File tree

2 files changed

+84
-110
lines changed

2 files changed

+84
-110
lines changed

docs/c-runtime-library/reference/strncmp-wcsncmp-mbsncmp-mbsncmp-l.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ The **strncmp** function performs an ordinal comparison of at most the first *co
7676

7777
**wcsncmp** and **_mbsncmp** are wide-character and multibyte-character versions of **strncmp**. The arguments of **wcsncmp** are wide-character strings; those of **_mbsncmp** are multibyte-character strings. **_mbsncmp** recognizes multibyte-character sequences according to a multibyte code page and returns **_NLSCMPERROR** on an error.
7878

79-
Also, **_mbsncmp** and **_mbsncmp_l** validate parameters. If *string1* or *string2* is a null pointer, the invalid parameter handler is invoked, as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md). If execution is allowed to continue, **_mbsncmp** and **_mbsncmp_l** return **_NLSCMPERROR** and set **errno** to **EINVAL**. **strncmp** and **wcsncmp** do not validate their parameters. These functions behave identically otherwise.
79+
Also, **_mbsncmp** and **_mbsncmp_l** validate parameters. If *string1* or *string2* is a null pointer and *count* is not equal to 0, the invalid parameter handler is invoked, as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md). If execution is allowed to continue, **_mbsncmp** and **_mbsncmp_l** return **_NLSCMPERROR** and set **errno** to **EINVAL**. **strncmp** and **wcsncmp** do not validate their parameters. These functions behave identically otherwise.
8080

8181
The comparison behavior of **_mbsncmp** and **_mbsncmp_l** is affected by the setting of the **LC_CTYPE** category setting of the locale. This controls detection of leading and trailing bytes of multibyte characters. For more information, see [setlocale](setlocale-wsetlocale.md). The **_mbsncmp** function uses the current locale for this locale-dependent behavior. The **_mbsncmp_l** function is identical except that it uses the *locale* parameter instead. For more information, see [Locale](../../c-runtime-library/locale.md). If the locale is a single-byte locale, the behavior of these functions is identical to **strncmp**.
8282

Lines changed: 83 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,123 @@
11
---
2-
description: "Learn more about: _variant_t::operator ="
3-
title: "_variant_t::operator ="
4-
ms.date: "11/04/2016"
2+
description: "Learn more about: _variant_t::operator="
3+
title: "_variant_t::operator="
4+
ms.date: 03/23/2021
55
f1_keywords: ["_variant_t::operator="]
66
helpviewer_keywords: ["operator= [C++], variant", "operator = [C++], variant", "= operator [C++], with specific Visual C++ objects"]
7-
ms.assetid: 77622723-6e49-4dec-9e0f-fa74028f1a3c
87
---
9-
# _variant_t::operator =
8+
# `_variant_t::operator=`
109

11-
**Microsoft Specific**
10+
Assigns a new value to a `_variant_t` instance.
11+
12+
The `_variant_t` class and its `operator=` member are **Microsoft-specific**.
1213

1314
## Syntax
1415

16+
```cpp
17+
_variant_t& operator=( const VARIANT& varSrc );
18+
_variant_t& operator=( const VARIANT* pVarSrc );
19+
_variant_t& operator=( const _variant_t& var_t_Src );
20+
_variant_t& operator=( short sSrc );
21+
_variant_t& operator=( long lSrc );
22+
_variant_t& operator=( float fltSrc );
23+
_variant_t& operator=( double dblSrc );
24+
_variant_t& operator=( const CY& cySrc );
25+
_variant_t& operator=( const _bstr_t& bstrSrc );
26+
_variant_t& operator=( const wchar_t* wstrSrc );
27+
_variant_t& operator=( const char* strSrc );
28+
_variant_t& operator=( IDispatch* pDispSrc );
29+
_variant_t& operator=( bool bSrc );
30+
_variant_t& operator=( IUnknown* pSrc );
31+
_variant_t& operator=( const DECIMAL& decSrc );
32+
_variant_t& operator=( BYTE byteSrc );
33+
_variant_t& operator=( char cSrc );
34+
_variant_t& operator=( unsigned short usSrc );
35+
_variant_t& operator=( unsigned long ulSrc );
36+
_variant_t& operator=( int iSrc );
37+
_variant_t& operator=( unsigned int uiSrc );
38+
_variant_t& operator=( __int64 i8Src );
39+
_variant_t& operator=( unsigned __int64 ui8Src );
1540
```
16-
_variant_t& operator=(
17-
const VARIANT& varSrc
18-
);
19-
20-
_variant_t& operator=(
21-
const VARIANT* pVarSrc
22-
);
23-
24-
_variant_t& operator=(
25-
const _variant_t& var_t_Src
26-
);
27-
28-
_variant_t& operator=(
29-
short sSrc
30-
);
31-
32-
_variant_t& operator=(
33-
long lSrc
34-
);
3541

36-
_variant_t& operator=(
37-
float fltSrc
38-
);
42+
### Parameters
3943

40-
_variant_t& operator=(
41-
double dblSrc
42-
);
44+
*`varSrc`*\
45+
A reference to a `VARIANT` from which to copy the content and `VT_*` type.
4346

44-
_variant_t& operator=(
45-
const CY& cySrc
46-
);
47+
*`pVarSrc`*\
48+
A pointer to a `VARIANT` from which to copy the content and `VT_*` type.
4749

48-
_variant_t& operator=(
49-
const _bstr_t& bstrSrc
50-
);
50+
*`var_t_Src`*\
51+
A reference to a `_variant_t` from which to copy the content and `VT_*` type.
5152

52-
_variant_t& operator=(
53-
const wchar_t* wstrSrc
54-
);
53+
*`sSrc`*\
54+
A **`short`** integer value to copy. Given type `VT_BOOL` if `*this` is of type `VT_BOOL`. Otherwise, it's given type `VT_I2`.
5555

56-
_variant_t& operator=(
57-
const char* strSrc
58-
);
56+
*`lSrc`*\
57+
A **`long`** integer value to copy. Given type `VT_BOOL` if `*this` is of type `VT_BOOL`. Given type `VT_ERROR` if `*this` is of type `VT_ERROR`. Otherwise, given type `VT_I4`.
5958

60-
_variant_t& operator=(
61-
IDispatch* pDispSrc
62-
);
59+
*`fltSrc`*\
60+
A **`float`** numerical value to copy. Given type `VT_R4`.
6361

64-
_variant_t& operator=(
65-
bool bSrc
66-
);
62+
*`dblSrc`*\
63+
A **`double`** numerical value to copy. Given type `VT_DATE` if `this` is of type `VT_DATE`. Otherwise, given type `VT_R8`.
6764

68-
_variant_t& operator=(
69-
IUnknown* pSrc
70-
);
65+
*`cySrc`*\
66+
A `CY` object to copy. Given type `VT_CY`.
7167

72-
_variant_t& operator=(
73-
const DECIMAL& decSrc
74-
);
68+
*`bstrSrc`*\
69+
A `BSTR` object to copy. Given type `VT_BSTR`.
7570

76-
_variant_t& operator=(
77-
BYTE bSrc
78-
);
71+
*`wstrSrc`*\
72+
A Unicode string to copy, stored as a `BSTR` and given type `VT_BSTR`.
7973

80-
_variant_t& operator=(
81-
char cSrc
82-
);
74+
*`strSrc`*\
75+
A multibyte string to copy, stored as a `BSTR` and given type `VT_BSTR`.
8376

84-
_variant_t& operator=(
85-
unsigned short usSrc
86-
);
77+
*`pDispSrc`*\
78+
An `IDispatch` pointer to copy with a call to `AddRef`. Given type `VT_DISPATCH`.
8779

88-
_variant_t& operator=(
89-
unsigned long ulSrc
90-
);
80+
*`bSrc`*\
81+
A **`bool`** value to copy. Given type `VT_BOOL`.
9182

92-
_variant_t& operator=(
93-
int iSrc
94-
);
83+
*`pSrc`*\
84+
An `IUnknown` pointer to copy with a call to `AddRef`. Given type `VT_UNKNOWN`.
9585

96-
_variant_t& operator=(
97-
unsigned int uiSrc
98-
);
86+
*`decSrc`*\
87+
A `DECIMAL` object to copy. Given type `VT_DECIMAL`.
9988

100-
_variant_t& operator=(
101-
__int64 i8Src
102-
);
103-
104-
_variant_t& operator=(
105-
unsigned __int64 ui8Src
106-
);
107-
```
108-
109-
## Remarks
89+
*`byteSrc`*\
90+
A `BYTE` value to copy. Given type `VT_UI1`.
11091

111-
The operator assigns a new value to the `_variant_t` object:
92+
*`cSrc`*\
93+
A **`char`** value to copy. Given type `VT_I1`.
11294

113-
- **operator=(** *varSrc* **)** Assigns an existing `VARIANT` to a `_variant_t` object.
95+
*`usSrc`*\
96+
An **`unsigned short`** value to copy. Given type `VT_UI2`.
11497

115-
- **operator=(** *pVarSrc* **)** Assigns an existing `VARIANT` to a `_variant_t` object.
98+
*`ulSrc`*\
99+
An **`unsigned long`** value to copy. Given type `VT_UI4`.
116100

117-
- **operator=(** *var_t_Src* **)** Assigns an existing `_variant_t` object to a `_variant_t` object.
101+
*`iSrc`*\
102+
An **`int`** value to copy. Given type `VT_INT`.
118103

119-
- **operator=(** *sSrc* **)** Assigns a **`short`** integer value to a `_variant_t` object.
104+
*`uiSrc`*\
105+
An **`unsigned int`** value to copy. Given type `VT_UINT`.
120106

121-
- **operator=(** `lSrc` **)** Assigns a **`long`** integer value to a `_variant_t` object.
107+
*`i8Src`*\
108+
An **`__int64`** or **`long long`** value to copy. Given type `VT_I8`.
122109

123-
- **operator=(** *fltSrc* **)** Assigns a **`float`** numerical value to a `_variant_t` object.
110+
*`ui8Src`*\
111+
An **`unsigned __int64`** or **`unsigned long long`** value to copy. Given type `VT_UI8`.
124112

125-
- **operator=(** *dblSrc* **)** Assigns a **`double`** numerical value to a `_variant_t` object.
126-
127-
- **operator=(** *cySrc* **)** Assigns a `CY` object to a `_variant_t` object.
128-
129-
- **operator=(** *bstrSrc* **)** Assigns a `BSTR` object to a `_variant_t` object.
130-
131-
- **operator=(** *wstrSrc* **)** Assigns a Unicode string to a `_variant_t` object.
132-
133-
- **operator=(** `strSrc` **)** Assigns a multibyte string to a `_variant_t` object.
134-
135-
- **operator=(** `bSrc` **)** Assigns a **`bool`** value to a `_variant_t` object.
136-
137-
- **operator=(** *pDispSrc* **)** Assigns an `IDispatch*` object to a `_variant_t` object and calls `AddRef`.
138-
139-
- **operator=(** *pIUnknownSrc* **)** Assigns an `IUnknown*` object to a `_variant_t` object and calls `AddRef`.
113+
## Remarks
140114

141-
- **operator=(** *decSrc* **)** Assigns a `DECIMAL` value to a `_variant_t` object.
115+
The `operator=` assignment operator clears any existing value, which deletes object types, or calls `Release` for `IDispatch*` and `IUnknown*` types. Then, it copies a new value into the `_variant_t` object. It changes the `_variant_t` type to match the assigned value, except as noted for **`short`**, **`long`**, and **`double`** arguments. Value types are copied directly. A `VARIANT` or `_variant_t` pointer or reference argument copies the assigned object's contents and type. Other pointer or reference type arguments create a copy of the assigned object. The assignment operator calls `AddRef` for `IDispatch*` and `IUnknown*` arguments.
142116

143-
- **operator=(** `bSrc` **)** Assigns a `BYTE` value to a `_variant_t` object.
117+
`operator=` invokes [`_com_raise_error`](../cpp/com-raise-error.md) if an error occurs.
144118

145-
**END Microsoft Specific**
119+
`operator=` returns a reference to the updated `_variant_t` object.
146120

147121
## See also
148122

149-
[_variant_t Class](../cpp/variant-t-class.md)
123+
[`_variant_t` class](../cpp/variant-t-class.md)

0 commit comments

Comments
 (0)