Skip to content

Commit 16c378b

Browse files
author
mtx48109
committed
cpp formatting review pr14
1 parent 4dd72c1 commit 16c378b

30 files changed

+84
-115
lines changed

docs/cpp/cdecl.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ms.workload: ["cplusplus"]
1515
# __cdecl
1616
**Microsoft Specific**
1717

18-
`__cdecl` is the default calling convention for C and C++ programs. Because the stack is cleaned up by the caller, it can do **vararg** functions. The `__cdecl` calling convention creates larger executables than [__stdcall](../cpp/stdcall.md), because it requires each function call to include stack cleanup code. The following list shows the implementation of this calling convention.
18+
**__cdecl** is the default calling convention for C and C++ programs. Because the stack is cleaned up by the caller, it can do `vararg` functions. The **__cdecl** calling convention creates larger executables than [__stdcall](../cpp/stdcall.md), because it requires each function call to include stack cleanup code. The following list shows the implementation of this calling convention.
1919

2020
|Element|Implementation|
2121
|-------------|--------------------|
@@ -27,9 +27,9 @@ ms.workload: ["cplusplus"]
2727
> [!NOTE]
2828
> For related information, see [Decorated Names](../build/reference/decorated-names.md).
2929
30-
Place the `__cdecl` modifier before a variable or a function name. Because the C naming and calling conventions are the default, the only time you must use `__cdecl` in x86 code is when you have specified the **/Gv** (vectorcall), **/Gz** (stdcall), or **/Gr** (fastcall) compiler option. The [/Gd](../build/reference/gd-gr-gv-gz-calling-convention.md) compiler option forces the `__cdecl` calling convention.
30+
Place the **__cdecl** modifier before a variable or a function name. Because the C naming and calling conventions are the default, the only time you must use **__cdecl** in x86 code is when you have specified the `/Gv` (vectorcall), `/Gz` (stdcall), or `/Gr` (fastcall) compiler option. The [/Gd](../build/reference/gd-gr-gv-gz-calling-convention.md) compiler option forces the **__cdecl** calling convention.
3131

32-
On ARM and x64 processors, `__cdecl` is accepted but typically ignored by the compiler. By convention on ARM and x64, arguments are passed in registers when possible, and subsequent arguments are passed on the stack. In x64 code, use `__cdecl` to override the **/Gv** compiler option and use the default x64 calling convention.
32+
On ARM and x64 processors, **__cdecl** is accepted but typically ignored by the compiler. By convention on ARM and x64, arguments are passed in registers when possible, and subsequent arguments are passed on the stack. In x64 code, use **__cdecl** to override the **/Gv** compiler option and use the default x64 calling convention.
3333

3434
For non-static class functions, if the function is defined out-of-line, the calling convention modifier does not have to be specified on the out-of-line definition. That is, for class non-static member methods, the calling convention specified during declaration is assumed at the point of definition. Given this class definition:
3535

@@ -61,6 +61,6 @@ int __cdecl system(const char *);
6161
typedef BOOL (__cdecl *funcname_ptr)(void * arg1, const char * arg2, DWORD flags, ...);
6262
```
6363

64-
## See Also
64+
## See also
6565
[Argument Passing and Naming Conventions](../cpp/argument-passing-and-naming-conventions.md)
6666
[Keywords](../cpp/keywords-cpp.md)

docs/cpp/char-wchar-t-char16-t-char32-t.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,4 @@ The **wchar_t** type is an implementation-defined wide character type. In the Mi
3131
3232
The **char16_t** and **char32_t** types represent 16-bit and 32-bit wide characters, respectively. Unicode encoded as UTF-16 can be stored in the **char16_t** type, and Unicode encoded as UTF-32 can be stored in the **char32_t** type. Strings of these types and **wchar_t** are all referred to as *wide* strings, though the term often refers specifically to strings of **wchar_t** type.
3333
34-
In the C++ standard library, the `basic_string` type is specialized for both narrow and wide strings. Use `std::string` when the characters are of type **char**, `std::u16string` when the characters are of type **char16_t**, `std::u32string` when the characters are of type **char32_t**, and `std::wstring` when the characters are of type **wchar_t**. Other types that represent text, including `std::stringstream` and `std::cout` have specializations for narrow and wide strings.
35-
34+
In the C++ standard library, the `basic_string` type is specialized for both narrow and wide strings. Use `std::string` when the characters are of type **char**, `std::u16string` when the characters are of type **char16_t**, `std::u32string` when the characters are of type **char32_t**, and `std::wstring` when the characters are of type **wchar_t**. Other types that represent text, including `std::stringstream` and `std::cout` have specializations for narrow and wide strings.

docs/cpp/character-sets.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,11 @@ The text of a C++ program is stored in source files that use a particular charac
4545
```cpp
4646
auto \u30AD = 42; // \u30AD is 'キ'
4747
if (キ == 42) return true; // \u30AD and キ are the same to the compiler
48-
4948
```
5049

5150
The format of extended characters on the Windows clipboard is specific to application locale settings. Cutting and pasting these characters into your code from another application may introduce unexpected character encodings. This can result in parsing errors with no visible cause in your code. We recommend that you set your source file encoding to a Unicode codepage before pasting extended characters. We also recommend that you use an IME or the Character Map app to generate extended characters.
5251

5352
**END Microsoft Specific**
5453

5554
### Basic execution character set
56-
The *basic execution character set* and the *basic execution wide-character set* consist of all the characters in the basic source character set, and the control characters that represent alert, backspace, carriage return, and the null character. The *execution character set* and *execution wide-character set* are supersets of the basic sets. They include the implementation-defined source characters outside the basic source character set. The execution character set has a locale-specific representation.
55+
The *basic execution character set* and the *basic execution wide-character set* consist of all the characters in the basic source character set, and the control characters that represent alert, backspace, carriage return, and the null character. The *execution character set* and *execution wide-character set* are supersets of the basic sets. They include the implementation-defined source characters outside the basic source character set. The execution character set has a locale-specific representation.

docs/cpp/class-cpp.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ The **class** keyword declares a class type or defines an object of a class type
1818
## Syntax
1919

2020
```
21-
2221
[template-spec]
2322
class [ms-decl-spec] [tag [: base-list ]]
2423
{
@@ -137,6 +136,6 @@ int main()
137136
}
138137
```
139138
140-
## See Also
139+
## See also
141140
[Keywords](../cpp/keywords-cpp.md)
142141
[Classes and Structs](../cpp/classes-and-structs-cpp.md)

docs/cpp/class-member-overview.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ For more information, see [Special Member Functions](../cpp/special-member-funct
111111
In C++11 and later, non-static member declarators can contain initializers.
112112
113113
```cpp
114-
115114
class CanInit
116115
{
117116
public:
@@ -161,5 +160,5 @@ int CanInit2::j = i;
161160
> [!NOTE]
162161
> The class name, `CanInit2`, must precede `i` to specify that the `i` being defined is a member of class `CanInit2`.
163162
164-
## See Also
165-
[Classes and Structs](../cpp/classes-and-structs-cpp.md)
163+
## See also
164+
[Classes and Structs](../cpp/classes-and-structs-cpp.md)

docs/cpp/class-templates.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ void X<T>::mf(const U &u)
6969
int main()
7070
{
7171
}
72-
7372
```
7473

7574
## Nested class templates
@@ -432,5 +431,5 @@ int main()
432431
}
433432
```
434433

435-
## See Also
436-
[Templates](../cpp/templates-cpp.md)
434+
## See also
435+
[Templates](../cpp/templates-cpp.md)

docs/cpp/classes-and-structs-cpp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,5 @@ This section introduces C++ classes and structs. The two constructs are identica
5656
|Default access is public|Default access is private|Default access is public|
5757
|No usage constraints|No usage constraints|Use only one member at a time|
5858

59-
## See Also
59+
## See also
6060
[C++ Language Reference](../cpp/cpp-language-reference.md)

docs/cpp/cleaning-up-resources.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ ms.author: "mblome"
1212
ms.workload: ["cplusplus"]
1313
---
1414
# Cleaning up Resources
15-
During termination-handler execution, you may not know which resources are actually allocated before the termination handler was called. It is possible that the `__try` statement block was interrupted before all resources were allocated, so that not all resources were opened.
15+
During termination-handler execution, you may not know which resources are actually allocated before the termination handler was called. It is possible that the **__try** statement block was interrupted before all resources were allocated, so that not all resources were opened.
1616

1717
Therefore, to be safe, you should check to see which resources are actually open before proceeding with termination-handling cleanup. A recommended procedure is to:
1818

1919
1. Initialize handles to NULL.
2020

21-
2. In the `__try` statement block, allocate resources. Handles are set to positive values as the resource is allocated.
21+
2. In the **__try** statement block, allocate resources. Handles are set to positive values as the resource is allocated.
2222

23-
3. In the `__finally` statement block, release each resource whose corresponding handle or flag variable is nonzero or not NULL.
23+
3. In the **__finally** statement block, release each resource whose corresponding handle or flag variable is nonzero or not NULL.
2424

2525
## Example
26-
For example, the following code uses a termination handler to close three files and a memory block that were allocated in the `__try` statement block. Before cleaning up a resource, the code first checks to see if the resource was allocated.
26+
For example, the following code uses a termination handler to close three files and a memory block that were allocated in the **__try** statement block. Before cleaning up a resource, the code first checks to see if the resource was allocated.
2727

2828
```cpp
2929
// exceptions_Cleaning_up_Resources.cpp
@@ -63,6 +63,6 @@ int main() {
6363
}
6464
```
6565

66-
## See Also
66+
## See also
6767
[Writing a Termination Handler](../cpp/writing-a-termination-handler.md)
6868
[Structured Exception Handling (C/C++)](../cpp/structured-exception-handling-c-cpp.md)

docs/cpp/clrcall.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,25 @@ ms.workload: ["cplusplus"]
1616

1717
**Microsoft Specific**
1818

19-
Specifies that a function can only be called from managed code. Use `__clrcall` for all virtual functions that will only be called from managed code. However this calling convention cannot be used for functions that will be called from native code.
19+
Specifies that a function can only be called from managed code. Use **__clrcall** for all virtual functions that will only be called from managed code. However this calling convention cannot be used for functions that will be called from native code.
2020

21-
Use `__clrcall` to improve performance when calling from a managed function to a virtual managed function or from managed function to managed function through pointer.
21+
Use **__clrcall** to improve performance when calling from a managed function to a virtual managed function or from managed function to managed function through pointer.
2222

23-
Entry points are separate, compiler-generated functions. If a function has both native and managed entry points, one of them will be the actual function with the function implementation. The other function will be a separate function (a thunk) that calls into the actual function and lets the common language runtime perform PInvoke. When marking a function as `__clrcall`, you indicate the function implementation must be MSIL and that the native entry point function will not be generated.
23+
Entry points are separate, compiler-generated functions. If a function has both native and managed entry points, one of them will be the actual function with the function implementation. The other function will be a separate function (a thunk) that calls into the actual function and lets the common language runtime perform PInvoke. When marking a function as **__clrcall**, you indicate the function implementation must be MSIL and that the native entry point function will not be generated.
2424

25-
When taking the address of a native function if `__clrcall` is not specified, the compiler uses the native entry point. `__clrcall` indicates that the function is managed and there is no need to go through the transition from managed to native. In that case the compiler uses the managed entry point.
25+
When taking the address of a native function if **__clrcall** is not specified, the compiler uses the native entry point. **__clrcall** indicates that the function is managed and there is no need to go through the transition from managed to native. In that case the compiler uses the managed entry point.
2626

27-
When **/clr** (not **/clr:pure** or **/clr:safe**) is used and `__clrcall` is not used, taking the address of a function always returns the address of the native entry point function. When `__clrcall` is used, the native entry point function is not created, so you get the address of the managed function, not an entry point thunk function. For more information, see [Double Thunking](../dotnet/double-thunking-cpp.md). The **/clr:pure** and **/clr:safe** compiler options are deprecated in Visual Studio 2015 and unsupported in Visual Studio 2017.
27+
When `/clr` (not `/clr:pure` or `/clr:safe`) is used and **__clrcall** is not used, taking the address of a function always returns the address of the native entry point function. When **__clrcall** is used, the native entry point function is not created, so you get the address of the managed function, not an entry point thunk function. For more information, see [Double Thunking](../dotnet/double-thunking-cpp.md). The **/clr:pure** and **/clr:safe** compiler options are deprecated in Visual Studio 2015 and unsupported in Visual Studio 2017.
2828

29-
[/clr (Common Language Runtime Compilation)](../build/reference/clr-common-language-runtime-compilation.md) implies that all functions and function pointers are `__clrcall` and the compiler will not permit a function inside the compiland to be marked anything other than `__clrcall`. When **/clr:pure** is used, `__clrcall` can only be specified on function pointers and external declarations.
29+
[/clr (Common Language Runtime Compilation)](../build/reference/clr-common-language-runtime-compilation.md) implies that all functions and function pointers are **__clrcall** and the compiler will not permit a function inside the compiland to be marked anything other than **__clrcall**. When **/clr:pure** is used, **__clrcall** can only be specified on function pointers and external declarations.
3030

31-
You can directly call `__clrcall` functions from existing C++ code that was compiled by using **/clr** as long as that function has an MSIL implementation. `__clrcall` functions cannot be called directly from functions that have inline asm and call CPU-specific intrinisics, for example, even if those functions are compiled with **/clr**.
31+
You can directly call **__clrcall** functions from existing C++ code that was compiled by using **/clr** as long as that function has an MSIL implementation. **__clrcall** functions cannot be called directly from functions that have inline asm and call CPU-specific intrinisics, for example, even if those functions are compiled with `/clr`.
3232

33-
`__clrcall` function pointers are only meant to be used in the application domain in which they were created. Instead of passing `__clrcall` function pointers across application domains, use <xref:System.CrossAppDomainDelegate>. For more information, see [Application Domains and Visual C++](../dotnet/application-domains-and-visual-cpp.md).
33+
**__clrcall** function pointers are only meant to be used in the application domain in which they were created. Instead of passing **__clrcall** function pointers across application domains, use <xref:System.CrossAppDomainDelegate>. For more information, see [Application Domains and Visual C++](../dotnet/application-domains-and-visual-cpp.md).
3434

3535
## Example
3636

37-
Note that when a function is declared with `__clrcall`, code will be generated when needed; for example, when function is called.
37+
Note that when a function is declared with **__clrcall**, code will be generated when needed; for example, when function is called.
3838

3939
```cpp
4040
// clrcall2.cpp
@@ -92,6 +92,5 @@ int main() {
9292
```
9393

9494
## See also
95-
96-
- [Argument Passing and Naming Conventions](../cpp/argument-passing-and-naming-conventions.md)
97-
- [Keywords](../cpp/keywords-cpp.md)
95+
[Argument Passing and Naming Conventions](../cpp/argument-passing-and-naming-conventions.md)
96+
[Keywords](../cpp/keywords-cpp.md)

0 commit comments

Comments
 (0)