Skip to content

Commit 936f155

Browse files
Merge pull request #5032 from TylerMSFT/github4706
Github4706
2 parents 7120177 + 73c8e30 commit 936f155

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

docs/c-runtime-library/crt-initialization.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ description: "Describes how the CRT initializes global state in native code."
44
ms.topic: "conceptual"
55
ms.date: 08/02/2021
66
helpviewer_keywords: ["CRT initialization [C++]"]
7-
ms.assetid: e7979813-1856-4848-9639-f29c86b74ad7
87
---
98
# CRT initialization
109

@@ -16,9 +15,9 @@ It's possible, though not recommended, to take advantage of Microsoft-specific l
1615

1716
## Initializing a global object
1817

19-
Consider the following code:
18+
Consider the following C++ code (C won't allow this code because it doesn't allow a function call in a constant expression).
2019

21-
```C
20+
```cpp
2221
int func(void)
2322
{
2423
return 3;
@@ -69,7 +68,6 @@ Offset Type Applied To Index Name
6968
The CRT defines two pointers:
7069

7170
- `__xc_a` in `.CRT$XCA`
72-
7371
- `__xc_z` in `.CRT$XCZ`
7472

7573
Neither group has any other symbols defined except `__xc_a` and `__xc_z`.
@@ -88,7 +86,7 @@ The section should resemble this example:
8886
__xc_z
8987
```
9088

91-
So, the CRT library uses both `__xc_a` and `__xc_z` to determine the start and end of the global initializers list because of the way in which they're laid out in memory after the image is loaded.
89+
The CRT library uses both `__xc_a` and `__xc_z` to determine the start and end of the global initializers list because of the way in which they're laid out in memory after the image is loaded.
9290

9391
## Linker features for initialization
9492

@@ -112,4 +110,5 @@ The names `.CRT$XCT` and `.CRT$XCV` aren't used by either the compiler or the CR
112110
113111
## See also
114112
113+
[`_initterm, _initterm_e`](./reference/initterm-initterm-e.md)\
115114
[C runtime (CRT) and C++ Standard Library (STL) `.lib` files](./crt-library-features.md)

docs/cpp/fastcall.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
description: "Learn more about: __fastcall"
33
title: "__fastcall"
4-
ms.date: "12/17/2018"
4+
ms.date: 09/14/2023
55
f1_keywords: ["__fastcall_cpp", "__fastcall", "_fastcall"]
66
helpviewer_keywords: ["__fastcall keyword [C++]"]
7-
ms.assetid: bb5b9c8a-dfad-450c-9119-0ac2bc59544f
87
---
98
# __fastcall
109

@@ -14,10 +13,12 @@ The **`__fastcall`** calling convention specifies that arguments to functions ar
1413

1514
|Element|Implementation|
1615
|-------------|--------------------|
17-
|Argument-passing order|The first two DWORD or smaller arguments that are found in the argument list from left to right are passed in ECX and EDX registers; all other arguments are passed on the stack from right to left.|
16+
|Argument-passing order|The first two `DWORD` or smaller arguments that are found in the argument list from left to right are passed in ECX and EDX registers; all other arguments are passed on the stack from right to left.|
1817
|Stack-maintenance responsibility|Called function pops the arguments from the stack.|
1918
|Name-decoration convention|At sign (\@) is prefixed to names; an at sign followed by the number of bytes (in decimal) in the parameter list is suffixed to names.|
2019
|Case-translation convention|No case translation performed.|
20+
|Classes, structs, and unions|Treated as "multibyte" types (regardless of size) and passed on the stack. |
21+
|Enums and enum classes | Passed by register if their underlying type is passed by register. For example, if the underlying type is `int` or `unsigned int` of size 8, 16, or 32 bits. |
2122

2223
> [!NOTE]
2324
> Future compiler versions may use different registers to store parameters.
@@ -26,7 +27,7 @@ Using the [/Gr](../build/reference/gd-gr-gv-gz-calling-convention.md) compiler o
2627

2728
The **`__fastcall`** keyword is accepted and ignored by the compilers that target ARM and x64 architectures; on an x64 chip, by convention, the first four arguments are passed in registers when possible, and additional arguments are passed on the stack. For more information, see [x64 Calling Convention](../build/x64-calling-convention.md). On an ARM chip, up to four integer arguments and eight floating-point arguments may be passed in registers, and additional arguments are passed on the stack.
2829

29-
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:
30+
For nonstatic class functions, if the function is defined out-of-line, the calling convention modifier doesn't 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:
3031

3132
```cpp
3233
struct CMyClass {
@@ -46,7 +47,7 @@ is equivalent to this:
4647
void __fastcall CMyClass::mymethod() { return; }
4748
```
4849
49-
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.
50+
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.
5051
5152
## Example
5253

0 commit comments

Comments
 (0)