You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fixed broken link in high level nav page
* various broken links in cpp folder
* link fixed
* link fixes in cpp lang docs
* more link fixes
* link fixes in concrt
* fixed codecvt-* filenames
* link fixes in atl
* link fixes in atl-mfc-shared
* link fixes in data/odbc casing still not fixed
* fixed links to members in mfc
* fixed casing in link paths
* moved top files back into top
* more link fixes
* links in high level TOC to restore links to top, plus misc other fixes
* fixed build error and misc links
* more link fixes
* Fix missed merge issue
* Fix another merge issue.
* misc link fixes
* Fix merge conflict issues
Copy file name to clipboardExpand all lines: docs/atl-mfc-shared/allocating-and-releasing-memory-for-a-bstr.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,19 +46,19 @@ When you create `BSTR`s and pass them between COM objects, you must take care in
46
46
47
47
- When you call into a function that expects a `BSTR` argument, you must allocate the memory for the `BSTR` before the call and release it afterwards. For example:
- When you implement a function that returns a `BSTR`, allocate the string but do not free it. The receiving the function releases the memory. For example:
Multiple threads could be running using this same thread procedure but since each thread has its own heap there is no contention between threads. In addition, the fact that each heap is not thread-safe gives a measurable increase in performance even if just one copy of the thread is running. This is the result of the heap not using expensive interlocked operations to protect against concurrent access.
The contents of a `CString` object are copied when one `CString` object is assigned to another. Therefore, the two strings do not share a reference to the actual characters that make up the string. For more information about how to use `CString` objects as values, see [CString Semantics](../atl-mfc-shared/cstring-semantics.md).
73
73
@@ -80,7 +80,7 @@ This topic explains the following basic [CString](../atl-mfc-shared/reference/cs
80
80
## <aname="_core_concatenating_two_cstring_objects"></a> Concatenating Two CString Objects
81
81
To concatenate two `CString` objects, use the concatenation operators (+ or +=), as follows.
At least one argument to the concatenation operators (+ or +=) must be a `CString` object, but you can use a constant character string (for example, `"big"`) or a `char` (for example, 'x') for the other argument.
86
86
@@ -97,7 +97,7 @@ This topic explains the following basic [CString](../atl-mfc-shared/reference/cs
97
97
98
98
The `CStringT` class template defines the relational operators (<, \<=, >=, >, ==, and !=), which are available for use by `CString`. You can compare two `CStrings` by using these operators, as shown in the following example.
For information about converting CString objects to other string types, see [How to: Convert Between Various String Types](../text/how-to-convert-between-various-string-types.md).
Copy file name to clipboardExpand all lines: docs/atl-mfc-shared/cstring-argument-passing.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,9 +55,9 @@ This article explains how to pass [CString](../atl-mfc-shared/reference/cstringt
55
55
## <aname="_core_strings_as_function_outputs"></a> Strings as Function Outputs
56
56
Typically you can return `CString` objects from functions because `CString` objects follow value semantics like primitive types. To return a read-only string, use a constant `CString` reference (**const CString&**). The following example illustrates the use of `CString` parameters and return types:
Sometimes you may require a copy of `CString` data to modify directly. Use the more secured function `strcpy_s` (or the Unicode/MBCS-portable `_tcscpy_s`) to copy the `CString` object into a separate buffer. This is where characters can be safely modified, as shown by the following example.
> The third argument to `strcpy_s` (or the Unicode/MBCS-portable `_tcscpy_s`) is either a `const``wchar_t*` (Unicode) or a `const``char*` (ANSI). The example above passes a `CString` for this argument. The C++ compiler automatically applies the conversion function defined for the `CString` class that converts a `CString` to an `LPCTSTR`. The ability to define casting operations from one type to another is one of the most useful features of C++.
For most functions that need a string argument, it is best to specify the formal parameter in the function prototype as a `const` pointer to a character (`LPCTSTR`) instead of a `CString`. When a formal parameter is specified as a `const` pointer to a character, you can pass either a pointer to a `TCHAR` array, a literal string [`"hi there"`], or a `CString` object. The `CString` object will be automatically converted to an `LPCTSTR`. Any place you can use an `LPCTSTR`, you can also use a `CString` object.
110
110
111
111
You can also specify a formal parameter as a constant string reference (that is, `const``CString&`) if the argument will not be modified. Drop the `const` modifier if the string will be modified by the function. If a default null value is desired, initialize it to the null string [`""`], as shown below:
Copy file name to clipboardExpand all lines: docs/atl-mfc-shared/cstring-semantics.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ Even though [CString](../atl-mfc-shared/reference/cstringt-class.md) objects are
39
39
40
40
You can assign one **CString** object to another. However, when you modify one of the two `CString` objects, the other `CString` object is not modified, as shown by the following example:
Note in the example that the two `CString` objects are considered "equal" because they represent the same character string. The `CString` class overloads the equality operator (`==`) to compare two `CString` objects based on their value (contents) rather than their identity (address).
0 commit comments