Skip to content

Commit 711ceaf

Browse files
TylerMSFTTylerMSFT
authored andcommitted
bug fix: 1536384 note implicit compiler flag that is set when using header units. Also, update how null is specified.
1 parent e0121e8 commit 711ceaf

2 files changed

Lines changed: 17 additions & 9 deletions

File tree

docs/build/walkthrough-header-units.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about C++ header units. Convert a header file to a header unit using Visual Studio 2022."
33
title: "Walkthrough: Build and import header units in Visual C++ projects"
4-
ms.date: 02/04/2022
4+
ms.date: 05/09/2022
55
ms.custom: "conceptual"
66
author: "tylermsft"
77
ms.author: "twhitney"
@@ -143,6 +143,14 @@ These features are designed for legacy code. For new code, move to modules inste
143143

144144
For an example of how this technique is used to import STL header files as header units, see [Walkthrough: Import STL libraries as header units](walkthrough-import-stl-header-units.md#approach2).
145145

146+
## Compiler flag side effects
147+
148+
The compiler implicitly enables the new C99 and C++11 conforming preprocessor when compiling header units. That is, [`/Zc:preprocessor`](/cpp/build/reference/zc-preprocessor) is added to the command line by the compiler if any form of `/exportHeader` is used.
149+
150+
Enabling the new preprocessor affects processing variadic macros. See the remarks section of [Variadic macros](/cpp/preprocessor/variadic-macros#remarks) for details.
151+
152+
To opt out of the implicit `/Zc:preprocessor`, add `/Zc:preprocessor-` to the command line switches to use the traditional (non-conforming) preprocessor.
153+
146154
## See also
147155

148156
[`/translateInclude`](./reference/translateinclude.md)\

docs/text/how-to-convert-between-various-string-types.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description: "Learn more about: How to: Convert Between Various String Types"
33
title: "How to: Convert Between Various String Types"
44
ms.custom: "get-started-article"
5-
ms.date: 05/04/2022
5+
ms.date: 05/09/2022
66
helpviewer_keywords: ["converting string types", "string conversion [C++]", "strings [C++], converting"]
77
---
88
# How to: Convert between various string types
@@ -40,7 +40,7 @@ The `/clr` switch conflicts with some compiler switches that are set when you cr
4040

4141
### Description
4242

43-
This example demonstrates how to convert from a `char *` to the string types listed above. A `char *` string (also known as a C-style string) uses a null character to indicate the end of the string. C-style strings usually require 1 byte per character, but can also use 2 bytes. In the examples below, `char *` strings are sometimes referred to as multibyte character strings because of the string data that results from converting from wide Unicode strings. Single byte and multibyte character (`MBCS`) functions can operate on `char *` strings.
43+
This example demonstrates how to convert from a `char *` to the string types listed above. A `char *` string (also known as a C-style string) uses a terminating null to indicate the end of the string. C-style strings usually require 1 byte per character, but can also use 2 bytes. In the examples below, `char *` strings are sometimes referred to as multibyte character strings because of the string data that results from converting from wide Unicode strings. Single byte and multibyte character (`MBCS`) functions can operate on `char *` strings.
4444

4545
For information about running and debugging this example, see [Run the examples](#run-the-examples).
4646

@@ -267,7 +267,7 @@ Hello, World! (System::String)
267267

268268
### Description
269269

270-
This example demonstrates how to convert from a `_bstr_t` to other string types. The `_bstr_t` object encapsulates wide character `BSTR` strings. A `BSTR` string has a length value and doesn't use a null character to terminate the string, but the string type you convert to may require a terminating `NULL`.
270+
This example demonstrates how to convert from a `_bstr_t` to other string types. The `_bstr_t` object encapsulates wide character `BSTR` strings. A `BSTR` string has a length value and doesn't use a null character to terminate the string, but the string type you convert to may require a terminating null character.
271271

272272
For information about running and debugging this example, see [Run the examples](#run-the-examples).
273273
### Code
@@ -296,7 +296,7 @@ int main()
296296

297297
// Convert the wide character _bstr_t string to a C-style
298298
// string. To be safe, allocate two bytes for each character
299-
// in the char* string, including the terminating NULL.
299+
// in the char* string, including the terminating null.
300300
const size_t newsize = (orig.length() + 1) * 2;
301301
char* nstring = new char[newsize];
302302

@@ -368,7 +368,7 @@ Hello, World! (System::String)
368368

369369
### Description
370370

371-
This example demonstrates how to convert from a `CComBSTR` to other string types. Like `_bstr_t`, a `CComBSTR` object encapsulates wide character `BSTR` strings. A `BSTR` string has a length value and doesn't use a null character to terminate the string, but the string type you convert to may require a terminating `NULL`.
371+
This example demonstrates how to convert from a `CComBSTR` to other string types. Like `_bstr_t`, a `CComBSTR` object encapsulates wide character `BSTR` strings. A `BSTR` string has a length value and doesn't use a null character to terminate the string, but the string type you convert to may require a terminating null.
372372

373373
For information about running and debugging this example, see [Run the examples](#run-the-examples).
374374

@@ -403,7 +403,7 @@ int main()
403403
// Convert a wide character CComBSTR string to a
404404
// regular multibyte char* string. Allocate enough space
405405
// in the new string for the largest possible result,
406-
// including space for a terminating NULL.
406+
// including space for a terminating null.
407407
const size_t newsize = (orig.Length() + 1) * 2;
408408
char* nstring = new char[newsize];
409409

@@ -657,7 +657,7 @@ int main()
657657

658658
// Convert a wide character basic_string string to a multibyte char*
659659
// string. To be safe, we allocate two bytes for each character
660-
// in the original string, including the terminating NULL.
660+
// in the original string, including the terminating null.
661661
const size_t newsize = (orig.size() + 1) * 2;
662662

663663
char* nstring = new char[newsize];
@@ -765,7 +765,7 @@ int main()
765765
// Make a copy of the System::String as a multibyte
766766
// char* string. Allocate two bytes in the multibyte
767767
// output string for every wide character in the input
768-
// string, including space for a terminating NULL.
768+
// string, including space for a terminating null.
769769
size_t origsize = wcslen(wch) + 1;
770770
const size_t newsize = origsize * 2;
771771
size_t convertedChars = 0;

0 commit comments

Comments
 (0)