Skip to content

Commit 2c604f2

Browse files
authored
Merge pull request MicrosoftDocs#210 from Microsoft/master
updated links to various topics, and f1 for C++/CX
2 parents b8d8cb0 + 8fc64ce commit 2c604f2

88 files changed

Lines changed: 360 additions & 301 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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/TOC.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
## [Weak references and breaking cycles (C++/CX)](weak-references-and-breaking-cycles-c-cx.md)
3434
## [Namespaces Reference (C++/CX)](namespaces-reference-c-cx.md)
3535
### [default namespace](default-namespace.md)
36-
#### [default::(type_name)::Equals Method](default-type-name-equals-method.md)
37-
#### [default::(type_name)::GetHashCode Method](default-type-name-gethashcode-method.md)
38-
#### [default::(type_name)::GetType Method](default-type-name-gettype-method.md)
39-
#### [default::(type_name)::ToString Method](default-type-name-tostring-method.md)
36+
#### [default::(type_name)::Equals](default-type-name-equals-method.md)
37+
#### [default::(type_name)::GetHashCode](default-type-name-gethashcode-method.md)
38+
#### [default::(type_name)::GetType](default-type-name-gettype-method.md)
39+
#### [default::(type_name)::ToString](default-type-name-tostring-method.md)
4040
### [Platform namespace (C++/CX)](platform-namespace-c-cx.md)
4141
#### [Platform::AccessDeniedException Class](platform-accessdeniedexception-class.md)
4242
#### [Platform::Agile Class](platform-agile-class.md)
@@ -69,7 +69,7 @@
6969
#### [Platform::OperationCanceledException Class](platform-operationcanceledexception-class.md)
7070
#### [Platform::OutOfBoundsException Class](platform-outofboundsexception-class.md)
7171
#### [Platform::OutOfMemoryException Class](platform-outofmemoryexception-class.md)
72-
#### [Platform::ReCreateException Method](platform-recreateexception-method.md)
72+
#### [Platform::ReCreateException](platform-recreateexception-method.md)
7373
#### [Platform::SizeT value class](platform-sizet-value-class.md)
7474
#### [Platform::STAThreadAttribute Class](platform-stathreadattribute-class.md)
7575
#### [Platform::String Class](platform-string-class.md)

docs/cppcx/collections-c-cx.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void FindButton(UIElementCollection^ col)
9898
## Collection types
9999
Collections fall into four categories: modifiable versions and read-only versions of sequence collections and associative collections. In addition, C++/CX enhances collections by providing three iterator classes that simplify the accessing of collections.
100100

101-
Elements of a modifiable collection can be changed, but elements of a read-only collection, which is known as a *view*, can only be read. Elements of a [Platform::Collections::Vector](../cppcx/platform-collections-vector-class.md) or[Platform::Collections::VectorView](../cppcx/platform-collections-vectorview-class.md) collection can be accessed by using an iterator or the collection's [Vector::GetAt Method](../cppcx/platform-collections-vector-class.md#getat) and an index. Elements of an associative collection can be accessed by using the collection's [Map::Lookup Method](../cppcx/platform-collections-map-class.md#lookup) and a key.
101+
Elements of a modifiable collection can be changed, but elements of a read-only collection, which is known as a *view*, can only be read. Elements of a [Platform::Collections::Vector](../cppcx/platform-collections-vector-class.md) or[Platform::Collections::VectorView](../cppcx/platform-collections-vectorview-class.md) collection can be accessed by using an iterator or the collection's [Vector::GetAt](../cppcx/platform-collections-vector-class.md#getat) and an index. Elements of an associative collection can be accessed by using the collection's [Map::Lookup](../cppcx/platform-collections-map-class.md#lookup) and a key.
102102

103103
[Platform::Collections::Map Class](../cppcx/platform-collections-map-class.md)
104104
A modifiable, associative collection. Map elements are key-value pairs. Looking up a key to retrieve its associated value, and iterating through all key-value pairs, are both supported.

docs/cppcx/default-namespace.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ namespace default;
3232

3333
|||
3434
|-|-|
35-
|[default::(type_name)::Equals Method](../cppcx/default-type-name-equals-method.md)|Determines whether the specified object is equal to the current object.|
36-
|[default::(type_name)::GetHashCode Method](../cppcx/default-type-name-gethashcode-method.md)|Returns the hash code for this instance.|
37-
|[default::(type_name)::GetType Method](../cppcx/default-type-name-gettype-method.md)|Returns a string that represents the current type.|
38-
|[default::(type_name)::ToString Method](../cppcx/default-type-name-tostring-method.md)|Returns a string that represents the current type.|
35+
|[default::(type_name)::Equals](../cppcx/default-type-name-equals-method.md)|Determines whether the specified object is equal to the current object.|
36+
|[default::(type_name)::GetHashCode](../cppcx/default-type-name-gethashcode-method.md)|Returns the hash code for this instance.|
37+
|[default::(type_name)::GetType](../cppcx/default-type-name-gettype-method.md)|Returns a string that represents the current type.|
38+
|[default::(type_name)::ToString](../cppcx/default-type-name-tostring-method.md)|Returns a string that represents the current type.|
3939

4040
### Built-in types
4141

docs/cppcx/default-type-name-equals-method.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.suite: ""
99
ms.tgt_pltfrm: ""
1010
ms.topic: "language-reference"
1111
f1_keywords:
12-
- "Platform/Platform::Object::Equals"
12+
- "VCCORLIB/Platform::Object::Equals"
1313
dev_langs:
1414
- "C++"
1515
ms.assetid: 4450f835-06fc-4758-8d0a-72cf00007873

docs/cppcx/default-type-name-gethashcode-method.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.suite: ""
99
ms.tgt_pltfrm: ""
1010
ms.topic: "language-reference"
1111
f1_keywords:
12-
- "Platform/Platform::Object::GetHashCode"
12+
- "VCCORLIB/Platform::Object::GetHashCode"
1313
dev_langs:
1414
- "C++"
1515
ms.assetid: 58ea60f8-f820-4103-9b9b-b6635ada3fa5

docs/cppcx/default-type-name-gettype-method.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.suite: ""
99
ms.tgt_pltfrm: ""
1010
ms.topic: "language-reference"
1111
f1_keywords:
12-
- "Platform/Platform::Object::GetType"
12+
- "VCCORLIB/Platform::Object::GetType"
1313
dev_langs:
1414
- "C++"
1515
ms.assetid: 21d0bf92-fac4-48cd-9108-c6f57ba1196a

docs/cppcx/default-type-name-tostring-method.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.suite: ""
99
ms.tgt_pltfrm: ""
1010
ms.topic: "language-reference"
1111
f1_keywords:
12-
- "Platform/Platform::Object::ToString"
12+
- "VCCORLIB/Platform::Object::ToString"
1313
dev_langs:
1414
- "C++"
1515
ms.assetid: 2541955f-d844-4bd8-944d-185198c86579

0 commit comments

Comments
 (0)