Skip to content

Commit 8cefd1f

Browse files
Merge pull request #4777 from TylerMSFT/alttext
Improve descriptive text for images used by screenreaders, and ensure the graphics are still relevant.
2 parents a891ab6 + a34f8b1 commit 8cefd1f

19 files changed

+171
-153
lines changed

docs/atl/reference/compiler-options-macros.md

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
11
---
22
description: "Learn more about: Compiler Options Macros"
33
title: "Compiler Options Macros"
4-
ms.date: "08/19/2019"
4+
ms.date: 02/01/2023
55
f1_keywords: ["_ATL_ALL_WARNINGS", "_ATL_APARTMENT_THREADED", "_ATL_CSTRING_EXPLICIT_CONSTRUCTORS ", "_ATL_ENABLE_PTM_WARNING", "_ATL_FREE_THREADED", "_ATL_MODULES", "_ATL_MULTI_THREADED", "_ATL_NO_AUTOMATIC_NAMESPACE", "_ATL_NO_COM_SUPPORT", "ATL_NO_VTABLE", "ATL_NOINLINE", "_ATL_SINGLE_THREADED"]
66
helpviewer_keywords: ["compiler options, macros"]
7-
ms.assetid: a869adc6-b3de-4299-b040-9ae20b45f82c
87
---
98
# Compiler Options Macros
109

1110
These macros control specific compiler features.
1211

1312
|Macro|Description|
1413
|-|-|
15-
|[_ATL_ALL_WARNINGS](#_atl_all_warnings)|A symbol that enables errors in projects converted from previous versions of ATL.|
16-
|[_ATL_APARTMENT_THREADED](#_atl_apartment_threaded)|Define if one or more of your objects use apartment threading.|
17-
|[_ATL_CSTRING_EXPLICIT_CONSTRUCTORS](#_atl_cstring_explicit_constructors)|Makes certain `CString` constructors explicit, preventing any unintentional conversions.|
18-
|[_ATL_ENABLE_PTM_WARNING](#_atl_enable_ptm_warning)|Define this macro to require C++ standard syntax. It generates the C4867 compiler error when non-standard syntax is used to initialize a pointer to a member function.|
19-
|[_ATL_FREE_THREADED](#_atl_free_threaded)|Define if one or more of your objects use free or neutral threading.|
20-
|[_ATL_MODULES](#_ATL_MODULES)|Allows you to compile ATL projects with [permissive-](../../build/reference/permissive-standards-conformance.md) and use ATL with [C++ modules](../../cpp/modules-cpp.md).|
21-
|[_ATL_MULTI_THREADED](#_atl_multi_threaded)|A symbol that indicates the project will have objects that are marked as Both, Free or Neutral. The macro [_ATL_FREE_THREADED](#_atl_free_threaded) should be used instead.|
22-
|[_ATL_NO_AUTOMATIC_NAMESPACE](#_atl_no_automatic_namespace)|A symbol that prevents the default use of namespace as ATL.|
23-
|[_ATL_NO_COM_SUPPORT](#_atl_no_com_support)|A symbol that prevents COM-related code from being compiled with your project.|
24-
|[ATL_NO_VTABLE](#atl_no_vtable)|A symbol that prevents the vtable pointer from being initialized in the class's constructor and destructor.|
25-
|[ATL_NOINLINE](#atl_noinline)|A symbol that indicates a function shouldn't be inlined.|
26-
|[_ATL_SINGLE_THREADED](#_atl_single_threaded)|Define if all of your objects use the single threading model.|
27-
28-
## <a name="_atl_all_warnings"></a> _ATL_ALL_WARNINGS
14+
|[`_ATL_ALL_WARNINGS`](#_atl_all_warnings)|A symbol that enables errors in projects converted from previous versions of ATL.|
15+
|[`_ATL_APARTMENT_THREADED`](#_atl_apartment_threaded)|Define if one or more of your objects use apartment threading.|
16+
|[`_ATL_CSTRING_EXPLICIT_CONSTRUCTORS`](#_atl_cstring_explicit_constructors)|Makes certain `CString` constructors explicit, preventing any unintentional conversions.|
17+
|[`_ATL_ENABLE_PTM_WARNING`](#_atl_enable_ptm_warning)|Define this macro to require C++ standard syntax. It generates the C4867 compiler error when non-standard syntax is used to initialize a pointer to a member function.|
18+
|[`_ATL_FREE_THREADED`](#_atl_free_threaded)|Define if one or more of your objects use free or neutral threading.|
19+
|[`_ATL_MODULES`](#_ATL_MODULES)|Allows you to compile ATL projects with [permissive-](../../build/reference/permissive-standards-conformance.md) and use ATL with [C++ modules](../../cpp/modules-cpp.md).|
20+
|[`_ATL_MULTI_THREADED`](#_atl_multi_threaded)|A symbol that indicates the project has objects marked as Both, Free or Neutral. The macro [`_ATL_FREE_THREADED`](#_atl_free_threaded) should be used instead.|
21+
|[`_ATL_NO_AUTOMATIC_NAMESPACE`](#_atl_no_automatic_namespace)|A symbol that prevents the default use of namespace as ATL.|
22+
|[`_ATL_NO_COM_SUPPORT`](#_atl_no_com_support)|A symbol that prevents COM-related code from being compiled with your project.|
23+
|[`ATL_NO_VTABLE`](#atl_no_vtable)|A symbol that prevents the vtable pointer from being initialized in the class's constructor and destructor.|
24+
|[`ATL_NOINLINE`](#atl_noinline)|A symbol that indicates a function shouldn't be inlined.|
25+
|[`_ATL_SINGLE_THREADED`](#_atl_single_threaded)|Define if all of your objects use the single threading model.|
26+
27+
## <a name="_atl_all_warnings"></a> `_ATL_ALL_WARNINGS`
2928

3029
A symbol that enables errors in projects converted from previous versions of ATL.
3130

32-
```
31+
```cpp
3332
#define _ATL_ALL_WARNINGS
3433
```
3534

@@ -53,15 +52,15 @@ Before Visual C++ .NET 2002, ATL disabled many warnings and left them disabled s
5352

5453
In projects converted from previous versions, these warnings are still disabled by the libraries headers.
5554

56-
By adding the following line to the *pch.h* (*stdafx.h* in Visual Studio 2017 and earlier) file before including libraries headers, this behavior can be changed.
55+
To change this behavior, add the following line to the *`pch.h`* (*`stdafx.h`* in Visual Studio 2017 and earlier) file before including libraries headers.
5756

5857
[!code-cpp[NVC_ATL_Utilities#97](../../atl/codesnippet/cpp/compiler-options-macros_1.h)]
5958

6059
If this `#define` is added, the ATL headers are careful to preserve the state of these warnings so that they're not disabled globally (or if the user explicitly disables individual warnings, not to enable them).
6160

6261
New projects have this `#define` set in *pch.h* (*stdafx.h* in Visual Studio 2017 and earlier) by default.
6362

64-
## <a name="_atl_apartment_threaded"></a> _ATL_APARTMENT_THREADED
63+
## <a name="_atl_apartment_threaded"></a> `_ATL_APARTMENT_THREADED`
6564

6665
Define if one or more of your objects use apartment threading.
6766

@@ -73,23 +72,23 @@ _ATL_APARTMENT_THREADED
7372

7473
Specifies apartment threading. For other options, and a description of the threading models available for an ATL object, see [Specifying the Project's Threading Model](../../atl/specifying-the-threading-model-for-a-project-atl.md) and [Options, ATL Simple Object Wizard](../../atl/reference/options-atl-simple-object-wizard.md).
7574

76-
## <a name="_atl_cstring_explicit_constructors"></a> _ATL_CSTRING_EXPLICIT_CONSTRUCTORS
75+
## <a name="_atl_cstring_explicit_constructors"></a> `_ATL_CSTRING_EXPLICIT_CONSTRUCTORS`
7776

7877
Makes certain `CString` constructors explicit, preventing any unintentional conversions.
7978

80-
```cpp
79+
```
8180
_ATL_CSTRING_EXPLICIT_CONSTRUCTORS
8281
```
8382

8483
### Remarks
8584

86-
When this constructor is defined, all CString constructors that take a single parameter are compiled with the explicit keyword, which prevents implicit conversions of input arguments. This means, for example, that when _UNICODE is defined, if you attempt to use a char* string as a CString constructor argument, a compiler error will result. Use this macro in situations where you need to prevent implicit conversions between narrow and wide string types.
85+
When this constructor is defined, all `CString` constructors that take a single parameter are compiled with the explicit keyword, which prevents implicit conversions of input arguments. This means, for example, that when `_UNICODE` is defined, if you attempt to use a `char*` string as a `CString` constructor argument, a compiler error results. Use this macro in situations where you need to prevent implicit conversions between narrow and wide string types.
8786

88-
By using the _T macro on all constructor string arguments, you can define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS and avoid compile errors regardless of whether _UNICODE is defined.
87+
By using the `_T` macro on all constructor string arguments, you can define `_ATL_CSTRING_EXPLICIT_CONSTRUCTORS` and avoid compile errors regardless of whether `_UNICODE` is defined.
8988

90-
## <a name="_atl_enable_ptm_warning"></a> _ATL_ENABLE_PTM_WARNING
89+
## <a name="_atl_enable_ptm_warning"></a> `_ATL_ENABLE_PTM_WARNING`
9190

92-
Define this macro in order to force the use of ANSI C++ standard-conforming syntax for pointer to member functions. Using this macro will cause the C4867 compiler error to be generated when non-standard syntax is used to initialize a pointer to a member function.
91+
Define this macro in order to force the use of ANSI C++ standard-conforming syntax for pointer to member functions. Using this macro causes the C4867 compiler error to be generated when non-standard syntax is used to initialize a pointer to a member function.
9392

9493
```cpp
9594
#define _ATL_ENABLE_PTM_WARNING
@@ -99,7 +98,7 @@ Define this macro in order to force the use of ANSI C++ standard-conforming synt
9998

10099
The ATL and MFC libraries have been changed to match the Microsoft C++ compiler's improved standard C++ conformance. According to the ANSI C++ standard, the syntax of a pointer to a class member function should be `&CMyClass::MyFunc`.
101100

102-
When [_ATL_ENABLE_PTM_WARNING](#_atl_enable_ptm_warning) is not defined (the default case), ATL/MFC disables the C4867 error in macro maps (notably message maps) so that code that was created in earlier versions can continue to build as before. If you define **_ATL_ENABLE_PTM_WARNING**, your code should conform to the C++ standard.
101+
When [`_ATL_ENABLE_PTM_WARNING`](#_atl_enable_ptm_warning) isn't defined (the default case), ATL/MFC disables the C4867 error in macro maps (notably message maps) so that code that was created in earlier versions can continue to build as before. If you define `_ATL_ENABLE_PTM_WARNING`, your code should conform to the C++ standard.
103102

104103
However, the non-standard form has been deprecated. You need to move existing code to C++ standard syntax. For example, the following code:
105104

@@ -111,7 +110,7 @@ Should be changed to:
111110

112111
For map macros, add the ampersand '&' character. You shouldn't add the character again in your code.
113112

114-
## <a name="_atl_free_threaded"></a> _ATL_FREE_THREADED
113+
## <a name="_atl_free_threaded"></a> `_ATL_FREE_THREADED`
115114

116115
Define if one or more of your objects use free or neutral threading.
117116

@@ -125,13 +124,13 @@ Specifies free threading. Free threading is equivalent to a multithread apartmen
125124

126125
## <a name="_ATL_MODULES"></a> `_ATLMODULES`
127126

128-
Allows you to compile ATL projects with [permissive-](../../build/reference/permissive-standards-conformance.md) and use ATL with [C++ modules](../../cpp/modules-cpp.md).
127+
Allows you to compile ATL projects with [`permissive-`](../../build/reference/permissive-standards-conformance.md) and use ATL with [C++ modules](../../cpp/modules-cpp.md).
129128

130129
```
131130
_ATL_MODULES
132131
```
133132

134-
## <a name="_atl_multi_threaded"></a> _ATL_MULTI_THREADED
133+
## <a name="_atl_multi_threaded"></a> `_ATL_MULTI_THREADED`
135134

136135
A symbol that indicates the project will have objects that are marked as Both, Free or Neutral.
137136

@@ -141,9 +140,9 @@ _ATL_MULTI_THREADED
141140

142141
### Remarks
143142

144-
If this symbol is defined, ATL will pull in code that will correctly synchronize access to global data. New code should use the equivalent macro [_ATL_FREE_THREADED](#_atl_free_threaded) instead.
143+
If this symbol is defined, ATL pulls in code that will correctly synchronize access to global data. New code should use the equivalent macro [`_ATL_FREE_THREADED`](#_atl_free_threaded) instead.
145144

146-
## <a name="_atl_no_automatic_namespace"></a> _ATL_NO_AUTOMATIC_NAMESPACE
145+
## <a name="_atl_no_automatic_namespace"></a> `_ATL_NO_AUTOMATIC_NAMESPACE`
147146

148147
A symbol that prevents the default use of namespace as ATL.
149148

@@ -153,17 +152,17 @@ _ATL_NO_AUTOMATIC_NAMESPACE
153152

154153
### Remarks
155154

156-
If this symbol is not defined, including atlbase.h will perform **using namespace ATL** by default, which may lead to naming conflicts. To prevent this, define this symbol.
155+
If this symbol isn't defined, including `atlbase.h` performs `using namespace ATL` by default, which may lead to naming conflicts. To prevent this, define this symbol.
157156

158-
## <a name="_atl_no_com_support"></a> _ATL_NO_COM_SUPPORT
157+
## <a name="_atl_no_com_support"></a> `_ATL_NO_COM_SUPPORT`
159158

160159
A symbol that prevents COM-related code from being compiled with your project.
161160

162161
```
163162
_ATL_NO_COM_SUPPORT
164163
```
165164

166-
## <a name="atl_no_vtable"></a> ATL_NO_VTABLE
165+
## <a name="atl_no_vtable"></a> `ATL_NO_VTABLE`
167166

168167
A symbol that prevents the vtable pointer from being initialized in the class's constructor and destructor.
169168

@@ -173,13 +172,13 @@ ATL_NO_VTABLE
173172

174173
### Remarks
175174

176-
If the vtable pointer is prevented from being initialized in the class's constructor and destructor, the linker can eliminate the vtable and all of the functions to which it points. Expands to **`__declspec(novtable)`**.
175+
If the vtable pointer is prevented from being initialized in the class's constructor and destructor, the linker can eliminate the vtable and all of the functions to which it points. Expands to `__declspec(novtable)`.
177176

178177
### Example
179178

180179
[!code-cpp[NVC_ATL_COM#53](../../atl/codesnippet/cpp/compiler-options-macros_4.h)]
181180

182-
## <a name="atl_noinline"></a> ATL_NOINLINE
181+
## <a name="atl_noinline"></a> `ATL_NOINLINE`
183182

184183
A symbol that indicates a function shouldn't be inlined.
185184

@@ -193,14 +192,14 @@ A symbol that indicates a function shouldn't be inlined.
193192

194193
### Parameters
195194

196-
*myfunction*<br/>
195+
*`myfunction`*\
197196
The function that should not be inlined.
198197

199198
### Remarks
200199

201-
Use this symbol if you want to ensure a function does not get inlined by the compiler, even though it must be declared as inline so that it can be placed in a header file. Expands to **`__declspec(noinline)`**.
200+
Use this symbol if you want to ensure a function does not get inlined by the compiler, even though it must be declared as inline so that it can be placed in a header file. Expands to `__declspec(noinline)`.
202201

203-
## <a name="_atl_single_threaded"></a> _ATL_SINGLE_THREADED
202+
## <a name="_atl_single_threaded"></a> `_ATL_SINGLE_THREADED`
204203

205204
Define if all of your objects use the single threading model
206205

0 commit comments

Comments
 (0)