Skip to content

Commit 216997c

Browse files
authored
Merge branch 'master' into mb-cx-f1
2 parents 831fdc6 + cfd5b08 commit 216997c

16 files changed

Lines changed: 92 additions & 43 deletions

docs/cpp/attributes2.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ void Foo(int);
2626
- `carries_dependency`--specifies that the function propagates data dependency ordering with respect to thread synchronization. The attribute can be applied to one or more parameters, to specify that the passed-in argument carries a dependency into the function body. The attribute can be applied to the function itself, to specify that the return value carries a dependency out of the function. The compiler can use this information to generate more efficient code.
2727

2828
- `deprecated` – specifies that a function is not intended to be used, and might not exist in future versions of a library interface. The compiler can use this to generate an informational message when client code attempts to call the function. Can be applied to declaration of a class, a typedef-name, a variable, a non-static data member, a function, a namespace, an enumeration, an enumerator, or a template specialization.
29+
30+
- `fallthrough` - **Visual Studio 2017 and later:**(available with [/std:c++latest](../build/reference/std-specify-language-standard-version.md)) The `[[fallthrough]]` attribute can be used in the context of [switch](switch-statement-cpp.md) statements as a hint to the compiler (or anyone reading the code) that the fallthrough behavior is intended. The Visual C++ compiler currently does not warn on fallthrough behavior, so this attribute has no effect compiler behavior.
31+
32+
**Microsoft-specific:**
2933

3034
- `gsl::suppress` -- this Microsoft-specific attribute is used for suppressing warnings from checkers that enforce [Guidelines Support Library (GSL)](https://github.com/Microsoft/GSL) rules in code. For example, consider the code snippet below
3135

docs/cpp/range-based-for-statement-cpp.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ Executes `statement` repeatedly and sequentially for each element in `expression
4242
```
4343

4444
## Remarks
45-
Use the range-based `for` statement to construct loops that must execute through a "range", which is defined as anything that you can iterate through—for example, `std::vector`, or any other C++ Standard Library sequence whose range is defined by a `begin()` and `end()`. The name that is declared in the `for-range-declaration` portion is local to the `for` statement and cannot be re-declared in `expression` or `statement`. Note that the [auto](../cpp/auto-cpp.md) keyword is preferred in the `for-range-declaration` portion of the statement.
45+
Use the range-based `for` statement to construct loops that must execute through a "range", which is defined as anything that you can iterate through—for example, `std::vector`, or any other C++ Standard Library sequence whose range is defined by a `begin()` and `end()`. The name that is declared in the `for-range-declaration` portion is local to the `for` statement and cannot be re-declared in `expression` or `statement`. Note that the [auto](../cpp/auto-cpp.md) keyword is preferred in the `for-range-declaration` portion of the statement.
46+
47+
**New in Visual Studio 2017:** Range-based for loops no longer require that begin() and end() return objects of the same type. This enables end() to return a sentinel object such as used by ranges as defined in the Ranges-V3 proposal. For more information, see [Generalizing the Range-Based For Loop](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0184r0.html) and the [range-v3 library on GitHub](https://github.com/ericniebler/range-v3).
4648

47-
This code shows how to use ranged `for` loops to iterate through an array and a vector:
49+
This code shows how to use range-based `for` loops to iterate through an array and a vector:
4850

4951
```cpp
5052
// range-based-for.cpp
@@ -78,7 +80,7 @@ int main()
7880
}
7981
cout << endl;
8082

81-
for( const auto &y : x ) { // Type inference by reference.
83+
for( const auto &y : x ) { // Type inference by const reference.
8284
// Observes in-place. Preferred when no modify is needed.
8385
cout << y << " ";
8486
}

docs/cpp/switch-statement-cpp.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,39 @@ int main() {
9999
}
100100
```
101101

102-
In the above example, `capa` is incremented if `c` is an uppercase `A`. The `break` statement after `capa++` terminates execution of the `switch` statement body and control passes to the `while` loop. Without the `break` statement, `lettera` and `nota` would also be incremented. A similar purpose is served by the `break` statement for `case 'a'`. If `c` is a lowercase `a`, `lettera` is incremented and the `break` statement terminates the `switch` statement body. If `c` is not an `a` or `A`, the `default` statement is executed.
102+
In the above example, `capa` is incremented if `c` is an uppercase `A`. The `break` statement after `capa++` terminates execution of the `switch` statement body and control passes to the `while` loop. Without the `break` statement, execution would "fall through" to the next labeled statement, so that `lettera` and `nota` would also be incremented. A similar purpose is served by the `break` statement for `case 'a'`. If `c` is a lowercase `a`, `lettera` is incremented and the `break` statement terminates the `switch` statement body. If `c` is not an `a` or `A`, the `default` statement is executed.
103+
104+
**Visual Studio 2017 and later:** (available with [/std:c++latest](../build/reference/std-specify-language-standard-version.md)) The `[[fallthrough]]` attribute is specified in the C++17 standard. It can be used in a `switch` statement as a hint to the compiler (or to anyone reading the code) that fall-through behavior is intended. The Visual C++ compiler currently does not warn on fallthrough behavior, so this attribute has no effect compiler behavior. Note that the attribute is applied to an empty statement within the labeled statement; in other words the semicolon is necessary.
105+
106+
```cpp
107+
int main()
108+
{
109+
int n = 5;
110+
switch (n)
111+
{
112+
113+
case 1:
114+
a();
115+
break;
116+
case 2:
117+
b();
118+
d();
119+
[[fallthrough]]; // I meant to do this!
120+
case 3:
121+
c();
122+
break;
123+
default:
124+
d();
125+
break;
126+
}
127+
128+
return 0;
129+
}
130+
```
103131

104132
An inner block of a `switch` statement can contain definitions with initializations as long as they are reachable — that is, not bypassed by all possible execution paths. Names introduced using these declarations have local scope. For example:
105133

106-
```
134+
```cpp
107135
// switch_statement2.cpp
108136
// C2360 expected
109137
#include <iostream>
@@ -137,7 +165,8 @@ int main(int argc, char *argv[])
137165
```
138166
139167
A `switch` statement can be nested. In such cases, **case** or **default** labels associate with the closest `switch` statement that encloses them.
140-
168+
169+
141170
## Microsoft Specific
142171
Microsoft C does not limit the number of case values in a `switch` statement. The number is limited only by the available memory. ANSI C requires at least 257 case labels be allowed in a `switch` statement.
143172

docs/cppcx/platform-agile-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ throw();
154154
### Remarks
155155
This operation releases the current representation of a object of type `T`, if any; reinitializes the Agile object's data members; acquires the current threading context; and then returns the address of a handle-to-object variable that can represent a non-agile object. To cause an Agile class instance to represent an object, use the assignment operator ([Agile::operator=](#operator-assign)) to assign the object to the Agile class instance.
156156

157-
## <a name="getaddressofforinput"></a> Agile::GetAddressOfForInOut Method
157+
## <a name="getaddressofforinout"></a> Agile::GetAddressOfForInOut Method
158158
Returns the address of a handle to the object represented by the current Agile object.
159159

160160
## Syntax

docs/cppcx/platform-collections-map-class.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ ref class Map sealed;
9797

9898
**Namespace:** Platform::Collections
9999

100-
## Map::Clear Method
100+
## <a name="clear"></a> Map::Clear Method
101101
Removes all key-value pairs from the current Map object.
102102

103103
### Syntax
@@ -108,7 +108,7 @@ virtual void Clear();
108108

109109

110110

111-
## <a name="first"</a> Map::First Method
111+
## <a name="first"></a> Map::First Method
112112
Returns an iterator that specifies the first element in the map, or `nullptr` if the map is empty.
113113

114114
### Syntax
@@ -126,7 +126,7 @@ Windows::Foundation::Collections::IKeyValuePair<K, V>^>^ First();
126126

127127

128128

129-
## <a name="getview"</a> Map::GetView Method
129+
## <a name="getview"></a> Map::GetView Method
130130
Returns a read-only view of the current Map; that is, a [Platform::Collections::MapView Class](../cppcx/platform-collections-mapview-class.md), which implements the [Windows::Foundation::Collections::IMapView\<K,V>](http://msdn.microsoft.com/library/windows/apps/br226037.aspx) interface.
131131

132132
### Syntax
@@ -140,7 +140,7 @@ Windows::Foundation::Collections::IMapView<K, V>^ GetView();
140140

141141

142142

143-
## <a name="haskey"</a> Map::HasKey Method
143+
## <a name="haskey"></a> Map::HasKey Method
144144
Determines whether the current Map contains the specified key.
145145

146146
### Syntax
@@ -158,7 +158,7 @@ bool HasKey(K key);
158158

159159

160160

161-
## <a name="insert"</a> Map::Insert Method
161+
## <a name="insert"></a> Map::Insert Method
162162
Adds the specified key-value pair to the current Map object.
163163

164164
### Syntax
@@ -180,7 +180,7 @@ virtual bool Insert(K key, V value);
180180

181181

182182

183-
## <a name="lookup"</a> Map::Lookup Method
183+
## <a name="lookup"></a> Map::Lookup Method
184184
Retrieves the value of type V that is associated with the specified key of type K, if the key exists.
185185

186186
### Syntax
@@ -201,7 +201,7 @@ V Lookup(K key);
201201

202202

203203

204-
## <a name="ctor"</a> Map::Map Constructor
204+
## <a name="ctor"></a> Map::Map Constructor
205205
Initializes a new instance of the Map class.
206206

207207
### Syntax
@@ -235,7 +235,7 @@ Map(
235235

236236

237237

238-
## <a name="mapchanged"</a> Map::MapChanged Event
238+
## <a name="mapchanged"></a> Map::MapChanged Event
239239
Raised when an item is inserted into or removed from the map.
240240

241241
### Syntax
@@ -252,7 +252,7 @@ event Windows::Foundation::Collections::MapChangedEventHandler<K,V>^ MapChanged;
252252

253253

254254

255-
## <a name="remove"</a> Map::Remove Method
255+
## <a name="remove"></a> Map::Remove Method
256256
Deletes the specified key-value pair from the current Map object.
257257

258258
### Syntax
@@ -267,7 +267,7 @@ virtual void Remove(K key);
267267

268268

269269

270-
## <a name="size"</a> Map::Size Method
270+
## <a name="size"></a> Map::Size Method
271271
Returns the number of [Windows::Foundation::Collections::IKeyValuePair\<K,V>](http://msdn.microsoft.com/library/windows/apps/br226031.aspx) elements in the Map.
272272

273273
### Syntax

docs/cppcx/platform-collections-mapview-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ ref class MapView sealed;
7272
**Namespace:** Platform::Collections
7373

7474

75-
## MapView::First Method
75+
## <a name="first"></a> MapView::First Method
7676
Returns an iterator that specifies the first element in the map view.
7777

7878
### Syntax

docs/cppcx/platform-collections-vectoriterator-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ difference_type operator-(const VectorIterator& other) const;
287287

288288

289289

290-
## <a name="operator-plus-equals"></a> VectorIterator::operator+= Operator
290+
## <a name="operator-plus-assign"></a> VectorIterator::operator+= Operator
291291
Increments the current VectorIterator by the specified displacement.
292292

293293
### Syntax

docs/cppcx/platform-collections-vectorviewiterator-class.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class VectorViewIterator;
6767
|[VectorViewIterator::operator+= Operator](#operator-plus-assign)|Increments the current VectorViewIterator by the specified displacement.|
6868
|[VectorViewIterator::operator< Operator](#operator-less-than)|Indicates whether the current VectorViewIterator is less than a specified VectorViewIterator.|
6969
|[VectorViewIterator::operator\<= Operator](#operator-less-than-or-equals)|Indicates whether the current VectorViewIterator is less than or equal to a specified VectorViewIterator.|
70-
|[VectorViewIterator::operator-= Operator](#operator-subtract-assign)|Decrements the current VectorViewIterator by the specified displacement.|
70+
|[VectorViewIterator::operator-= Operator](#operator-minus-assign)|Decrements the current VectorViewIterator by the specified displacement.|
7171
|[VectorViewIterator::operator== Operator](#operator-equality)|Indicates whether the current VectorViewIterator is equal to a specified VectorViewIterator.|
7272
|[VectorViewIterator::operator> Operator](#operator-greater-than)|Indicates whether the current VectorViewIterator is greater than a specified VectorViewIterator.|
7373
|[VectorViewIterator::operator-> Operator](#operator-arrow)|Retrieves the address of the element referenced by the current VectorViewIterator.|
@@ -168,7 +168,7 @@ bool operator>(const VectorViewIterator& other) const;
168168

169169

170170

171-
## <a name="operator-greater-than"></a> VectorViewIterator::operator&gt;= Operator
171+
## <a name="operator-greater-than-or-equals"></a> VectorViewIterator::operator&gt;= Operator
172172
Indicates whether the current VectorViewIterator is greater than or equal to the specified VectorViewIterator.
173173

174174
### Syntax
@@ -338,7 +338,7 @@ inline VectorViewIterator<T> operator+
338338

339339

340340

341-
## <a name="operator-minus-equals"></a> VectorViewIterator::operator-= Operator
341+
## <a name="operator-minus-assign"></a> VectorViewIterator::operator-= Operator
342342
Decrements the current VectorIterator by the specified displacement.
343343

344344
### Syntax

docs/cppcx/platform-intptr-value-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ IntPtr( __int64 handle-or-pointer ); IntPtr( void* value ); IntPtr( int 32-b
6161

6262

6363

64-
## <a name="op_explicit"> </a> IntPtr::op_explicit Operator
64+
## <a name="op-explicit"> </a> IntPtr::op_explicit Operator
6565
Converts the specified parameter to an IntPtr or a pointer to an IntPtr value.
6666

6767
### Syntax

docs/cppcx/platform-object-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public ref class Object : Object
5757
**Namespace:** Platform
5858
5959
60-
## Object::Equals Method
60+
## <a name="equals"></a> Object::Equals Method
6161
Determines whether the specified object is equal to the current object.
6262
6363
### Syntax

0 commit comments

Comments
 (0)