|
1 | 1 | ---
|
2 | 2 | title: "noalias"
|
3 |
| -ms.date: "02/09/2018" |
| 3 | +ms.date: 07/07/2020 |
4 | 4 | f1_keywords: ["noalias_cpp"]
|
5 | 5 | helpviewer_keywords: ["noalias __declspec keyword", "__declspec keyword [C++], noalias"]
|
6 | 6 | ms.assetid: efafa8b0-7f39-4edc-a81e-d287ae882c9b
|
7 | 7 | ---
|
8 |
| -# noalias |
| 8 | +# `noalias` |
9 | 9 |
|
10 |
| -**Microsoft Specific** |
| 10 | +**Microsoft-specific** |
11 | 11 |
|
12 |
| -**noalias** means that a function call does not modify or reference visible global state and only modifies the memory pointed to *directly* by pointer parameters (first-level indirections). |
| 12 | +**`noalias`** means that a function call doesn't modify or reference visible global state and only modifies the memory pointed to *directly* by pointer parameters (first-level indirections). |
13 | 13 |
|
14 |
| -If a function is annotated as **noalias**, the optimizer can assume that, in addition to the parameters themselves, only first-level indirections of pointer parameters are referenced or modified inside the function. The visible global state is the set of all data that is not defined or referenced outside of the compilation scope, and their address is not taken. The compilation scope is all source files ([/LTCG (Link-time Code Generation)](../build/reference/ltcg-link-time-code-generation.md) builds) or a single source file (non-**/LTCG** build). |
| 14 | +If a function is annotated as **`noalias`**, the optimizer can assume that only the parameters themselves, and only first-level indirections of pointer parameters, are referenced or modified inside the function. |
15 | 15 |
|
16 |
| -The **noalias** annotation only applies within the body of the annotated function. Marking a function as **__declspec(noalias)** does not affect the aliasing of pointers returned by the function. |
| 16 | +The **`noalias`** annotation only applies within the body of the annotated function. Marking a function as **`__declspec(noalias)`** doesn't affect the aliasing of pointers returned by the function. |
17 | 17 |
|
18 |
| -For another annotation that can impact aliasing, see [__declspec(restrict)](../cpp/restrict.md). |
| 18 | +For another annotation that can impact aliasing, see [`__declspec(restrict)`](../cpp/restrict.md). |
19 | 19 |
|
20 | 20 | ## Example
|
21 | 21 |
|
22 |
| -The following sample demonstrates the use of **__declspec(noalias)**. |
| 22 | +The following sample demonstrates the use of **`__declspec(noalias)`**. |
23 | 23 |
|
24 |
| -When the function `multiply` that accesses memory is annotated **__declspec(noalias)**, it tells the compiler that this function does not modify the global state except through the pointers in its parameter list. |
| 24 | +When the function `multiply` that accesses memory is annotated **`__declspec(noalias)`**, it tells the compiler that this function doesn't modify the global state except through the pointers in its parameter list. |
25 | 25 |
|
26 | 26 | ```C
|
27 | 27 | // declspec_noalias.c
|
@@ -91,6 +91,6 @@ int main()
|
91 | 91 |
|
92 | 92 | ## See also
|
93 | 93 |
|
94 |
| -[__declspec](../cpp/declspec.md)<br/> |
| 94 | +[`__declspec`](../cpp/declspec.md)<br/> |
95 | 95 | [Keywords](../cpp/keywords-cpp.md)<br/>
|
96 |
| -[__declspec(restrict)](../cpp/restrict.md) |
| 96 | +[`__declspec(restrict)`](../cpp/restrict.md) |
0 commit comments