You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cpp/class-member-overview.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ translation.priority.ht:
36
36
- "zh-tw"
37
37
---
38
38
# Class Member Overview
39
-
A class or struct consists of its members. The work that a class does is performed by its member functions. The state that it maintains is stored in its data members. Initialization of members is done by constructors, and cleanup work such as freeing of memory and releasing of resources is done by constructors. In C++11 and later, data members can (and usually should) be initialized at the point of declaration.
39
+
A class or struct consists of its members. The work that a class does is performed by its member functions. The state that it maintains is stored in its data members. Initialization of members is done by constructors, and cleanup work such as freeing of memory and releasing of resources is done by destructors. In C++11 and later, data members can (and usually should) be initialized at the point of declaration.
40
40
41
41
## Kinds of class members
42
42
The full list of member categories is as follows:
@@ -186,4 +186,4 @@ int CanInit2::j = i;
186
186
> The class name, `CanInit2`, must precede `i` to specify that the `i` being defined is a member of class `CanInit2`.
187
187
188
188
## See Also
189
-
[Classes and Structs](../cpp/classes-and-structs-cpp.md)
189
+
[Classes and Structs](../cpp/classes-and-structs-cpp.md)
Copy file name to clipboardExpand all lines: docs/cpp/noalias.md
+86-86Lines changed: 86 additions & 86 deletions
Original file line number
Diff line number
Diff line change
@@ -4,24 +4,24 @@ ms.custom: ""
4
4
ms.date: "11/04/2016"
5
5
ms.reviewer: ""
6
6
ms.suite: ""
7
-
ms.technology:
7
+
ms.technology:
8
8
- "cpp-language"
9
9
ms.tgt_pltfrm: ""
10
10
ms.topic: "language-reference"
11
-
f1_keywords:
11
+
f1_keywords:
12
12
- "noalias"
13
13
- "noalias_cpp"
14
-
dev_langs:
14
+
dev_langs:
15
15
- "C++"
16
-
helpviewer_keywords:
16
+
helpviewer_keywords:
17
17
- "noalias __declspec keyword"
18
18
- "__declspec keyword [C++], noalias"
19
19
ms.assetid: efafa8b0-7f39-4edc-a81e-d287ae882c9b
20
20
caps.latest.revision: 12
21
21
author: "mikeblome"
22
22
ms.author: "mblome"
23
23
manager: "ghogen"
24
-
translation.priority.ht:
24
+
translation.priority.ht:
25
25
- "cs-cz"
26
26
- "de-de"
27
27
- "es-es"
@@ -37,85 +37,85 @@ translation.priority.ht:
37
37
- "zh-tw"
38
38
---
39
39
# noalias
40
-
**Microsoft Specific**
41
-
42
-
`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).
43
-
44
-
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).
45
-
46
-
## Example
47
-
The following sample demonstrates using `__declspec(restrict)` and `__declspec(noalias)`. Normally, memory returned from `malloc` is `restrict`and `noalias`because the CRT headers are decorated appropriately.
48
-
49
-
However, in this example, the pointers `mempool` and `memptr` are global so the compiler has no assurance that the memory is not subject to aliasing. Decorating the functions that return pointers with `__declspec(restrict)` tells the compiler that the memory pointed to by the return value is not aliased.
50
-
51
-
Decorating the function in the example that accesses memory with `__declspec(noalias)` tells the compiler that this function does not interfere with the global state except through the pointers in its parameter list.
52
-
53
-
```
54
-
// declspec_noalias.c
55
-
#include <stdio.h>
56
-
#include <stdlib.h>
57
-
58
-
#define M 800
59
-
#define N 600
60
-
#define P 700
61
-
62
-
float * mempool, * memptr;
63
-
64
-
__declspec(restrict) float * ma(int size)
65
-
{
66
-
float * retval;
67
-
retval = memptr;
68
-
memptr += size;
69
-
return retval;
70
-
}
71
-
72
-
__declspec(restrict) float * init(int m, int n)
73
-
{
74
-
float * a;
75
-
int i, j;
76
-
int k=1;
77
-
78
-
a = ma(m * n);
79
-
if (!a) exit(1);
80
-
for (i=0; i<m; i++)
81
-
for (j=0; j<n; j++)
82
-
a[i*n+j] = 0.1/k++;
83
-
return a;
84
-
}
85
-
86
-
__declspec(noalias) void multiply(float * a, float * b, float * c)
`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).
43
+
44
+
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).
45
+
46
+
## Example
47
+
The following sample demonstrates using `__declspec(restrict)` and `__declspec(noalias)`. Normally, memory returned from `malloc` is `restrict` because the CRT headers are decorated appropriately.
48
+
49
+
However, in this example, the pointers `mempool` and `memptr` are global so the compiler has no assurance that the memory is not subject to aliasing. Decorating the functions that return pointers with `__declspec(restrict)` tells the compiler that the memory pointed to by the return value is not aliased.
50
+
51
+
Decorating the function in the example that accesses memory with `__declspec(noalias)` tells the compiler that this function does not interfere with the global state except through the pointers in its parameter list.
52
+
53
+
```
54
+
// declspec_noalias.c
55
+
#include <stdio.h>
56
+
#include <stdlib.h>
57
+
58
+
#define M 800
59
+
#define N 600
60
+
#define P 700
61
+
62
+
float * mempool, * memptr;
63
+
64
+
__declspec(restrict) float * ma(int size)
65
+
{
66
+
float * retval;
67
+
retval = memptr;
68
+
memptr += size;
69
+
return retval;
70
+
}
71
+
72
+
__declspec(restrict) float * init(int m, int n)
73
+
{
74
+
float * a;
75
+
int i, j;
76
+
int k=1;
77
+
78
+
a = ma(m * n);
79
+
if (!a) exit(1);
80
+
for (i=0; i<m; i++)
81
+
for (j=0; j<n; j++)
82
+
a[i*n+j] = 0.1/k++;
83
+
return a;
84
+
}
85
+
86
+
__declspec(noalias) void multiply(float * a, float * b, float * c)
Copy file name to clipboardExpand all lines: docs/cpp/special-member-functions.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ The *special member functions* are class (or struct) member functions that, in c
43
43
44
44
You can explicitly declare a default special member function by using the `= default` keyword. This causes the compiler to define the function only if needed, in the same way as if the function was not declared at all.
45
45
46
-
In some cases, the compiler may generate *deleted* special member functions, which are not defined and therefore not callable. This can happen in cases where a call to a particular special member function on a class doesn't make sense, given other properties of the class. To explicitly prevent automatic generation of a special member function, you can declare it as deleted by using the `= deleted` keyword.
46
+
In some cases, the compiler may generate *deleted* special member functions, which are not defined and therefore not callable. This can happen in cases where a call to a particular special member function on a class doesn't make sense, given other properties of the class. To explicitly prevent automatic generation of a special member function, you can declare it as deleted by using the `= delete` keyword.
47
47
48
48
The compiler generates a *default constructor*, a constructor that takes no arguments, only when you have not declared any other constructor. If you have declared only a constructor that takes parameters, code that attempts to call a default constructor causes the compiler to produce an error message. The compiler-generated default constructor performs simple member-wise [default initialization](initializers.md#default_initialization) of the object. Default initialization leaves all member variables in an indeterminate state.
If you have a template collection class that takes any type **T**, you can create a partial specialization that takes any pointer type **T\***. The following code demonstrates a collection class template `Bag` and a partial specialization for pointer types in which the collection dereferences the pointer types before copying them to the array. The collection then stores the values that are pointed to. With the original template, only the pointers themselves would have been stored in the collection, leaving the data vulnerable to deletion or modification. In this special pointer version of the collection, code to check for a null pointer in the `add` method is added.
92
+
If you have a template collection class that takes any type **T**, you can create a partial specialization that takes any pointer type **T***. The following code demonstrates a collection class template `Bag` and a partial specialization for pointer types in which the collection dereferences the pointer types before copying them to the array. The collection then stores the values that are pointed to. With the original template, only the pointers themselves would have been stored in the collection, leaving the data vulnerable to deletion or modification. In this special pointer version of the collection, code to check for a null pointer in the `add` method is added.
Copy file name to clipboardExpand all lines: docs/preprocessor/hash-import-directive-cpp.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -194,7 +194,7 @@ using namespace MyLib;
194
194
195
195
You must determine which of the dependency comments are not otherwise provided for by system headers and then provide an `#import` directive at some point before the `#import` directive of the dependent type library to resolve the errors.
196
196
197
-
For more information, see the Knowledge Base article "#import Wrapper Methods May Cause Access Violation" (Q242527) or "Compiler Errors When You Use #import with XML" (Q269194). You can find Knowledge Base articles on the MSDN Library media or at [http://support.microsoft.com/support/](http://support.microsoft.com/support/).
197
+
For more information, see the Knowledge Base article "#import Wrapper Methods May Cause Access Violation" (Q242527) or "Compiler Errors When You Use #import with XML" (Q269194). You can find Knowledge Base articles on the MSDN Library media or at [Microsoft Support](https://support.microsoft.com/).
`#import` can optionally include one or more attributes. These attributes tell the compiler to modify the contents of the type-library headers. A backslash (**\\**) symbol can be used to include additional lines in a single `#import` statement. For example:
Copy file name to clipboardExpand all lines: docs/windows/desktop-applications-visual-cpp.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -65,4 +65,4 @@ A *desktop application* in C++ is a native application that can access the full
65
65
|[Visual C++](../visual-cpp-in-visual-studio.md)|Describes key features of Visual C++ in Visual Studio and links to the rest of the Visual C++ documentation.|
0 commit comments