Skip to content

Commit 5e4b17e

Browse files
author
Colin Robertson
authored
Merge pull request #1467 from corob-msft/cr_single_underscore
Fix DevCom issue: single underscore keywords
2 parents 81d77c9 + 1a222fe commit 5e4b17e

26 files changed

+116
-76
lines changed

docs/assembler/inline/asm.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
title: "__asm | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "08/30/2018"
4+
ms.date: "10/09/2018"
55
ms.technology: ["cpp-masm"]
66
ms.topic: "conceptual"
7-
f1_keywords: ["__asm", "__asm_cpp"]
7+
f1_keywords: ["__asm", "_asm", "__asm_cpp"]
88
dev_langs: ["C++"]
99
helpviewer_keywords: ["__asm keyword [C++], vs. asm blocks", "__asm keyword [C++]"]
1010
ms.assetid: 77ff3bc9-a492-4b5e-85e1-fa4e414e79cd
@@ -47,6 +47,8 @@ did not cause native code to be generated when compiled with **/clr**; the compi
4747

4848
`__asm int 3` now results in native code generation for the function. If you want a function to cause a break point in your code and if you want that function compiled to MSIL, use [__debugbreak](../../intrinsics/debugbreak.md).
4949

50+
For compatibility with previous versions, **_asm** is a synonym for **__asm** unless compiler option [/Za \(Disable language extensions)](../../build/reference/za-ze-disable-language-extensions.md) is specified.
51+
5052
## Example
5153

5254
The following code fragment is a simple `__asm` block enclosed in braces:

docs/build/calling-dll-functions-from-visual-basic-applications.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ For Visual Basic applications (or applications in other languages such as Pascal
1717

1818
`__stdcall` creates the correct calling convention for the function (the called function cleans up the stack and parameters are passed from right to left) but decorates the function name differently. So, when **__declspec(dllexport)** is used on an exported function in a DLL, the decorated name is exported.
1919

20-
The `__stdcall` name decoration prefixes the symbol name with an underscore (_) and appends the symbol with an at sign (**\@**) character followed by the number of bytes in the argument list (the required stack space). As a result, the function when declared as:
20+
The `__stdcall` name decoration prefixes the symbol name with an underscore ( **\_** ) and appends the symbol with an at sign (**\@**) character followed by the number of bytes in the argument list (the required stack space). As a result, the function when declared as:
2121

2222
```C
2323
int __stdcall func (int a, double b)
@@ -29,7 +29,7 @@ The C calling convention (`__cdecl`) decorates the name as `_func`.
2929
3030
To get the decorated name, use [/MAP](../build/reference/map-generate-mapfile.md). Use of **__declspec(dllexport)** does the following:
3131
32-
- If the function is exported with the C calling convention (**_cdecl**), it strips the leading underscore (_) when the name is exported.
32+
- If the function is exported with the C calling convention (`__cdecl`), it strips the leading underscore ( **\_** ) when the name is exported.
3333
3434
- If the function being exported does not use the C calling convention (for example, `__stdcall`), it exports the decorated name.
3535

docs/build/reference/gh-enable-penter-hook-function.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The `_penter` function is not part of any library and it is up to you to provide
2929
Unless you plan to explicitly call `_penter`, you do not need to provide a prototype. The function must appear as if it had the following prototype, and it must push the content of all registers on entry and pop the unchanged content on exit:
3030

3131
```
32-
void __declspec(naked) _cdecl _penter( void );
32+
void __declspec(naked) __cdecl _penter( void );
3333
```
3434

3535
This declaration is not available for 64-bit projects.
@@ -52,7 +52,7 @@ This declaration is not available for 64-bit projects.
5252

5353
The following code, when compiled with **/Gh**, shows how `_penter` is called twice; once when entering function `main` and once when entering function `x`.
5454

55-
```
55+
```cpp
5656
// Gh_compiler_option.cpp
5757
// compile with: /Gh
5858
// processor: x86
@@ -63,7 +63,7 @@ int main() {
6363
x();
6464
}
6565

66-
extern "C" void __declspec(naked) _cdecl _penter( void ) {
66+
extern "C" void __declspec(naked) __cdecl _penter( void ) {
6767
_asm {
6868
push eax
6969
push ebx

docs/build/reference/gh-enable-pexit-hook-function.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ The `_pexit` function is not part of any library and it is up to you to provide
2929
Unless you plan to explicitly call `_pexit`, you do not need to provide a prototype. The function must appear as if it had the following prototype, and it must push the content of all registers on entry and pop the unchanged content on exit:
3030

3131
```
32-
void __declspec(naked) _cdecl _pexit( void );
32+
void __declspec(naked) __cdecl _pexit( void );
3333
```
3434

3535
`_pexit` is similar to `_penter`; see [/Gh (Enable _penter Hook Function)](../../build/reference/gh-enable-penter-hook-function.md) for an example of how to write a `_pexit` function.

docs/build/reference/optimization-pragmas-and-keywords.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Several keywords and pragmas that you use in your C or C++ code affect optimizat
1919

2020
- [__assume](../../intrinsics/assume.md)
2121

22-
- [inline, _inline, or \__forceinline](../../cpp/inline-functions-cpp.md)
22+
- [inline, __inline, or \__forceinline](../../cpp/inline-functions-cpp.md)
2323

2424
- [#pragma auto_inline](../../preprocessor/auto-inline.md)
2525

docs/c-language/c-keywords.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "C Keywords | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "10/09/2018"
55
ms.technology: ["cpp-language"]
66
ms.topic: "language-reference"
77
dev_langs: ["C++"]
@@ -36,17 +36,19 @@ The following keywords and special identifiers are recognized by the Microsoft C
3636

3737
|||||
3838
|-|-|-|-|
39-
|**__asm**|**dllimport**<sup>2</sup>|**__int8**|**naked**<sup>2</sup>|
40-
|**__based**<sup>1</sup>|**__except**|**__int16**|**__stdcall**|
41-
|**__cdecl**|**__fastcall**|**__int32**|**thread**<sup>2</sup>|
42-
|**__declspec**|**__finally**|**__int64**|**__try**|
43-
|**dllexport**<sup>2</sup>|**__inline**|**__leave**||
39+
|**__asm**<sup>3</sup>|**dllimport**<sup>2</sup>|**__int8**<sup>3</sup>|**naked**<sup>2</sup>|
40+
|**__based**<sup>1, 3</sup>|**__except**<sup>3</sup>|**__int16**<sup>3</sup>|**__stdcall**<sup>3</sup>|
41+
|**__cdecl**<sup>3</sup>|**__fastcall**|**__int32**<sup>3</sup>|**thread**<sup>2</sup>|
42+
|**__declspec**<sup>3</sup>|**__finally**<sup>3</sup>|**__int64**<sup>3</sup>|**__try**<sup>3</sup>|
43+
|**dllexport**<sup>2</sup>|**__inline**<sup>3</sup>|**__leave**<sup>3</sup>||
4444

4545
<sup>1</sup> The **__based** keyword has limited uses for 32-bit and 64-bit target compilations.
4646

4747
<sup>2</sup> These are special identifiers when used with **__declspec**; their use in other contexts is not restricted.
4848

49-
Microsoft extensions are enabled by default. To ensure that your programs are fully portable, you can disable Microsoft extensions by specifying the /Za option (compile for ANSI compatibility) during compilation. When you do this, Microsoft-specific keywords are disabled.
49+
<sup>3</sup> For compatibility with previous versions, these keywords are available both with two leading underscores and a single leading underscore when Microsoft extensions are enabled.
50+
51+
Microsoft extensions are enabled by default. To ensure that your programs are fully portable, you can disable Microsoft extensions by specifying the [/Za \(Disable language extensions)](../build/reference/za-ze-disable-language-extensions.md) option during compilation. When you do this, some Microsoft-specific keywords are disabled.
5052

5153
When Microsoft extensions are enabled, you can use the keywords listed above in your programs. For ANSI compliance, most of these keywords are prefaced by a double underscore. The four exceptions, **dllexport**, **dllimport**, **naked**, and **thread**, are used only with **__declspec** and therefore do not require a leading double underscore. For backward compatibility, single-underscore versions of the rest of the keywords are supported.
5254

docs/cpp/alignof-operator.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
title: "__alignof Operator | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "10/09/2018"
55
ms.technology: ["cpp-language"]
66
ms.topic: "language-reference"
7-
f1_keywords: ["alignas_cpp", "__alignof_cpp", "alignof_cpp"]
7+
f1_keywords: ["alignas_cpp", "__alignof_cpp", "alignof_cpp", "__alignof", "_alignof"]
88
dev_langs: ["C++"]
99
helpviewer_keywords: ["alignas [C++]", "alignment of structures", "__alignof keyword [C++]", "alignof [C++]", "types [C++], alignment requirements"]
1010
ms.assetid: acb1eed7-6398-40bd-b0c5-684ceb64afbc
@@ -65,6 +65,8 @@ int n = 50; // array size
6565
S* p = (S*)aligned_malloc(n * sizeof(S), __alignof(S));
6666
```
6767

68+
For compatibility with previous versions, **_alignof** is a synonym for **__alignof** unless compiler option [/Za \(Disable language extensions)](../build/reference/za-ze-disable-language-extensions.md) is specified.
69+
6870
For more information on modifying alignment, see:
6971

7072
- [pack](../preprocessor/pack.md)

docs/cpp/based-pointers-cpp.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
title: "Based Pointers (C++) | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "10/09/2018"
55
ms.technology: ["cpp-language"]
66
ms.topic: "language-reference"
7-
f1_keywords: ["__based", "__based_cpp"]
7+
f1_keywords: ["__based", "_based", "__based_cpp"]
88
dev_langs: ["C++"]
99
helpviewer_keywords: ["__based keyword [C++]", "based pointers", "pointers, based"]
1010
ms.assetid: 1e5f2e96-c52e-4738-8e14-87278681205e
@@ -48,7 +48,7 @@ The pointer `vpBuffer` is assigned the address of memory allocated at some later
4848
4949
When dereferencing a based pointer, the base must be either explicitly specified or implicitly known through the declaration.
5050
51-
For compatibility with previous versions, **_based** is a synonym for **__based**.
51+
For compatibility with previous versions, **_based** is a synonym for **__based** unless compiler option [/Za \(Disable language extensions)](../build/reference/za-ze-disable-language-extensions.md) is specified.
5252
5353
## Example
5454

docs/cpp/cdecl.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
title: "__cdecl | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "10/09/2018"
55
ms.technology: ["cpp-language"]
66
ms.topic: "language-reference"
7-
f1_keywords: ["__cdecl_cpp"]
7+
f1_keywords: ["__cdecl_cpp", "__cdecl", "_cdecl", "cdecl"]
88
dev_langs: ["C++"]
99
helpviewer_keywords: ["__cdecl keyword [C++]"]
1010
ms.assetid: 1ff1d03e-fb4e-4562-8be1-74f1ad6427f1
@@ -52,6 +52,8 @@ is equivalent to this:
5252
void __cdecl CMyClass::mymethod() { return; }
5353
```
5454
55+
For compatibility with previous versions, **cdecl** and **_cdecl** are a synonym for **__cdecl** unless compiler option [/Za \(Disable language extensions)](../build/reference/za-ze-disable-language-extensions.md) is specified.
56+
5557
## Example
5658
5759
In the following example, the compiler is instructed to use C naming and calling conventions for the `system` function.

docs/cpp/declspec.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
title: "__declspec | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "1/23/2018"
4+
ms.date: "10/09/2018"
55
ms.technology: ["cpp-language"]
66
ms.topic: "language-reference"
7-
f1_keywords: ["__declspec_cpp"]
7+
f1_keywords: ["__declspec_cpp", "__declspec", "_declspec"]
88
dev_langs: ["C++"]
99
helpviewer_keywords: ["__declspec keyword [C++]"]
1010
author: "mikeblome"
@@ -56,6 +56,8 @@ Extended attribute grammar supports these Microsoft-specific storage-class attri
5656

5757
The **code_seg**, **dllexport**, **dllimport**, **naked**, **noalias**, **nothrow**, **property**, **restrict**, **selectany**, **thread**, and **uuid** storage-class attributes are properties only of the declaration of the object or function to which they are applied. The **thread** attribute affects data and objects only. The **naked** and **spectre** attributes affect functions only. The **dllimport** and **dllexport** attributes affect functions, data, and objects. The **property**, **selectany**, and **uuid** attributes affect COM objects.
5858

59+
For compatibility with previous versions, **_declspec** is a synonym for **__declspec** unless compiler option [/Za \(Disable language extensions)](../build/reference/za-ze-disable-language-extensions.md) is specified.
60+
5961
The **__declspec** keywords should be placed at the beginning of a simple declaration. The compiler ignores, without warning, any **__declspec** keywords placed after * or & and in front of the variable identifier in a declaration.
6062

6163
A **__declspec** attribute specified in the beginning of a user-defined type declaration applies to the variable of that type. For example:

docs/cpp/extension-restrict.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
title: "__restrict | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "10/10/2018"
55
ms.technology: ["cpp-language"]
66
ms.topic: "language-reference"
7-
f1_keywords: ["__restrict_cpp"]
7+
f1_keywords: ["__restrict_cpp", "__restrict", "_restrict"]
88
dev_langs: ["C++"]
99
helpviewer_keywords: ["__restrict keyword [C++]"]
1010
ms.assetid: 2d151b4d-f930-49df-bd16-d8757ec7fa83
@@ -24,6 +24,8 @@ Like the **__declspec ( [restrict](../cpp/restrict.md) )** modifier, the **__res
2424

2525
Generally, if you affect the behavior of an entire function, it is better to use `__declspec ( restrict )` than the keyword.
2626

27+
For compatibility with previous versions, **_restrict** is a synonym for **__restrict** unless compiler option [/Za \(Disable language extensions)](../build/reference/za-ze-disable-language-extensions.md) is specified.
28+
2729
In Visual Studio 2015 and later, **__restrict** can be used on C++ references.
2830

2931
> [!NOTE]

docs/cpp/fastcall.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
title: "__fastcall | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "10/09/2018"
55
ms.technology: ["cpp-language"]
66
ms.topic: "language-reference"
7-
f1_keywords: ["__fastcall_cpp"]
7+
f1_keywords: ["__fastcall_cpp", "__fastcall", "_fastcall"]
88
dev_langs: ["C++"]
99
helpviewer_keywords: ["__fastcall keyword [C++]"]
1010
ms.assetid: bb5b9c8a-dfad-450c-9119-0ac2bc59544f
@@ -52,6 +52,8 @@ is equivalent to this:
5252
void __fastcall CMyClass::mymethod() { return; }
5353
```
5454
55+
For compatibility with previous versions, **_fastcall** is a synonym for **__fastcall** unless compiler option [/Za \(Disable language extensions)](../build/reference/za-ze-disable-language-extensions.md) is specified.
56+
5557
## Example
5658
5759
In the following example, the function `DeleteAggrWrapper` is passed arguments in registers:

docs/cpp/inheritance-keywords.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ regardless of command-line options or pragmas, pointers to members of `class S`
6161
> [!NOTE]
6262
> The same forward declaration of a class pointer-to-member representation should occur in every translation unit that declares pointers to members of that class, and the declaration should occur before the pointers to members are declared.
6363
64+
For compatibility with previous versions, **_single_inheritance**, **_multiple_inheritance**, and **_virtual_inheritance** are synonyms for **__single_inheritance**, **__multiple_inheritance**, and **__virtual_inheritance** unless compiler option [/Za \(Disable language extensions)](../build/reference/za-ze-disable-language-extensions.md) is specified.
65+
6466
**END Microsoft Specific**
6567
6668
## See also

docs/cpp/inline-functions-cpp.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
title: "Inline Functions (C++) | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "10/09/2018"
55
ms.technology: ["cpp-language"]
66
ms.topic: "language-reference"
7-
f1_keywords: ["__forceinline_cpp", "__inline_cpp", "inline_cpp"]
7+
f1_keywords: ["__forceinline_cpp", "__inline_cpp", "inline_cpp", "__inline", "_inline", "__forceinline", "_forceinline"]
88
dev_langs: ["C++"]
99
helpviewer_keywords: ["inline functions [C++], class members"]
1010
ms.assetid: 355f120c-2847-4608-ac04-8dda18ffe10c
@@ -71,7 +71,7 @@ Using inline functions can make your program faster because they eliminate the o
7171
7272
The compiler treats the inline expansion options and keywords as suggestions. There is no guarantee that functions will be inlined. You cannot force the compiler to inline a particular function, even with the **__forceinline** keyword. When compiling with **/clr**, the compiler will not inline a function if there are security attributes applied to the function.
7373
74-
The **inline** keyword is available only in C++. The **__inline** and **__forceinline** keywords are available in both C and C++. For compatibility with previous versions, **_inline** is a synonym for **__inline**.
74+
The **inline** keyword is available only in C++. The **__inline** and **__forceinline** keywords are available in both C and C++. For compatibility with previous versions, **_inline** and **_forceinline** are synonyms for **__inline**, and **__forceinline** unless compiler option [/Za \(Disable language extensions)](../build/reference/za-ze-disable-language-extensions.md) is specified.
7575
7676
The **inline** keyword tells the compiler that inline expansion is preferred. However, the compiler can create a separate instance of the function (instantiate) and create standard calling linkages instead of inserting the code inline. Two cases where this can happen are:
7777

docs/cpp/int8-int16-int32-int64.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
title: "__int8, __int16, __int32, __int64 | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "10/09/2018"
55
ms.technology: ["cpp-language"]
66
ms.topic: "language-reference"
7-
f1_keywords: ["__int8_cpp", "__int16_cpp", "__int32_cpp", "__int64_cpp"]
7+
f1_keywords: ["__int8_cpp", "__int16_cpp", "__int32_cpp", "__int64_cpp", "__int8", "__int16", "__int32", "__int64", "_int8", "_int16", "_int32", "_int64"]
88
dev_langs: ["C++"]
99
helpviewer_keywords: ["__int16 keyword [C++]", "integer data type [C++], integer types in C++", "__int32 keyword [C++]", "integer types [C++]", "__int8 keyword [C++]", "__int64 keyword [C++]"]
1010
ms.assetid: 8e384602-2578-4980-8cc8-da63842356b2
@@ -29,6 +29,8 @@ __int64 nHuge; // Declares 64-bit integer
2929

3030
The types **__int8**, **__int16**, and **__int32** are synonyms for the ANSI types that have the same size, and are useful for writing portable code that behaves identically across multiple platforms. The **__int8** data type is synonymous with type **char**, **__int16** is synonymous with type **short**, and **__int32** is synonymous with type **int**. The **__int64** type is synonymous with type **long long**.
3131

32+
For compatibility with previous versions, **_int8**, **_int16**, **_int32**, and **_int64** are synonyms for **__int8**, **__int16**, **__int32**, and **__int64** unless compiler option [/Za \(Disable language extensions)](../build/reference/za-ze-disable-language-extensions.md) is specified.
33+
3234
## Example
3335

3436
The following sample shows that an __int*xx* parameter will be promoted to **int**:

0 commit comments

Comments
 (0)