Skip to content

Commit bef4bb3

Browse files
author
Colin Robertson
committed
Merge remote-tracking branch 'refs/remotes/origin/master' into cr-redist
2 parents faf37bf + 15acd8d commit bef4bb3

File tree

214 files changed

+6395
-6243
lines changed

Some content is hidden

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

214 files changed

+6395
-6243
lines changed

docs/TOC.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
# [Visual C++ in Visual Studio 2017 RC](visual-cpp-in-visual-studio.md)
2-
# [What's New for Visual C++ in Visual Studio 2017 RC](what-s-new-for-visual-cpp-in-visual-studio.md)
3-
# [C++ conformance improvements in Visual Studio 2017](cpp-conformance-improvements-2017.md)
4-
# [Supported Platforms (Visual C++)](supported-platforms-visual-cpp.md)
5-
# [C Language](c-language/c-language-reference.md)
6-
# [C++ Language](cpp/cpp-language-reference.md)
7-
# [C/C++ Preprocessor](preprocessor/c-cpp-preprocessor-reference.md)
8-
# [C Runtime Library](c-runtime-library/c-run-time-library-reference.md)
9-
# [C++ Standard Library](standard-library/cpp-standard-library-reference.md)
10-
# [Windows Development](windows/overview-of-windows-programming-in-cpp.md)
11-
# [Linux Development](linux/download-install-and-setup-the-linux-development-workload.md)
12-
# [.NET Development with C++/CLI](dotnet/dotnet-programming-with-cpp-cli-visual-cpp.md)
13-
# [Cloud and Web Programming in Visual C++](cloud/cloud-and-web-programming-in-visual-cpp.md)
14-
## [C++ REST SDK (Codename "Casablanca")](cloud/cpp-rest-sdk-codename-casablanca.md)
15-
# [Parallel Programming](parallel/parallel-programming-in-visual-cpp.md)
16-
# [Data Access](data/data-access-programming-mfc-atl.md)
17-
# [Text and Strings](text/text-and-strings-in-visual-cpp.md)
18-
# [Using the Visual Studio IDE for C++](ide/ide-and-tools-for-visual-cpp-development.md)
19-
# [Compilers and Build Tools](build/building-c-cpp-programs.md)
20-
# [Porting and Upgrading Visual C++ Code](porting/visual-cpp-porting-and-upgrading-guide.md)
21-
# [Security Best Practices for C++](security/security-best-practices-for-cpp.md)
22-
## [Running as a Member of the Users Group](security/running-as-a-member-of-the-users-group.md)
23-
## [How User Account Control (UAC) Affects Your Application](security/how-user-account-control-uac-affects-your-application.md)
24-
# [Visual C++ Samples](visual-cpp-samples.md)
25-
# [Visual C++ Help and Community](visual-cpp-help-and-community.md)
26-
# [How to Report a Problem with the Visual C++ Toolset](how-to-report-a-problem-with-the-visual-cpp-toolset.md)
1+
# [Visual C++ in Visual Studio 2017](visual-cpp-in-visual-studio.md)
2+
# [What's New for Visual C++ in Visual Studio 2017](what-s-new-for-visual-cpp-in-visual-studio.md)
3+
# [C++ conformance improvements in Visual Studio 2017](cpp-conformance-improvements-2017.md)
4+
## [Visual C++ Language Conformance](visual-cpp-language-conformance.md)
5+
# [Supported Platforms (Visual C++)](supported-platforms-visual-cpp.md)
6+
# [C Language](c-language/c-language-reference.md)
7+
# [C++ Language](cpp/cpp-language-reference.md)
8+
# [C/C++ Preprocessor](preprocessor/c-cpp-preprocessor-reference.md)
9+
# [C Runtime Library](c-runtime-library/c-run-time-library-reference.md)
10+
# [C++ Standard Library](standard-library/cpp-standard-library-reference.md)
11+
# [Windows Development](windows/overview-of-windows-programming-in-cpp.md)
12+
# [Linux Development](linux/download-install-and-setup-the-linux-development-workload.md)
13+
# [.NET Development with C++/CLI](dotnet/dotnet-programming-with-cpp-cli-visual-cpp.md)
14+
# [Cloud and Web Programming in Visual C++](cloud/cloud-and-web-programming-in-visual-cpp.md)
15+
# [Parallel Programming](parallel/parallel-programming-in-visual-cpp.md)
16+
# [Data Access](data/data-access-programming-mfc-atl.md)
17+
# [Text and Strings](text/text-and-strings-in-visual-cpp.md)
18+
# [Using the Visual Studio IDE for C++](ide/ide-and-tools-for-visual-cpp-development.md)
19+
# [Compilers and Build Tools](build/building-c-cpp-programs.md)
20+
# [Porting and Upgrading Visual C++ Code](porting/visual-cpp-porting-and-upgrading-guide.md)
21+
# [Security Best Practices for C++](security/security-best-practices-for-cpp.md)
22+
## [Running as a Member of the Users Group](security/running-as-a-member-of-the-users-group.md)
23+
## [How User Account Control (UAC) Affects Your Application](security/how-user-account-control-uac-affects-your-application.md)
24+
# [Visual C++ Samples](visual-cpp-samples.md)
25+
# [Visual C++ Help and Community](visual-cpp-help-and-community.md)
26+
# [How to Report a Problem with the Visual C++ Toolset](how-to-report-a-problem-with-the-visual-cpp-toolset.md)

docs/cloud/cloud-and-web-programming-in-visual-cpp.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,18 @@ In C++, you have several options for connecting to the web and the cloud.
4949
[OneDrive API](https://dev.onedrive.com/README.htm)
5050
The OneDrive API provides a set of HTTP services to connect your application to files and folders in Office 365 and SharePoint Server 2016.
5151

52-
[C++ REST SDK (Codename "Casablanca")](cpp-rest-sdk-codename-casablanca.md)
53-
Provides convenient asynchronous HTTP wrapper methods that are designed for cross-platform compatibility and for use in desktop apps on operating systems back to Windows 7 and Windows Server 2012. You can also use these in Universal Windows Platform apps; however, for apps that target only Universal Windows Platform, we recommend that you use the `Windows::Web:HttpClient` class. The C++ REST SDK (codename "Casablanca") also provides helper classes that support REST calls and convert JSON data into C++ types. The SDK is available on [GitHub](https://github.com/Microsoft/cpprestsdk).
52+
[C++ REST SDK (Codename "Casablanca")](https://github.com/Microsoft/cpprestsdk)
53+
Provides a modern, cross-platform, asynchronous API for interacting with REST services.
54+
55+
- Perform REST calls against any HTTP server, with built-in support for JSON document parsing and serialization
56+
- Supports OAuth 1 and 2, including a local redirect listener
57+
- Make Websockets connections against remote services
58+
- A fully asynchronous task API based on PPL, including a built-in threadpool
59+
60+
Supports Windows Desktop (7+), Windows Server (2012+), Universal Windows Platform, Linux, OSX, Android, and iOS.
5461

5562
[Windows::Web::Http::HttpClient](https://msdn.microsoft.com/en-us/library/windows/apps/windows.web.http.httpclient.aspx)
56-
A Windows Runtime HTTP client class modeled on the .NET Framework class of the same name in the System.Web namespace. `HttpClient` fully supports asynchronous upload and download over HTTP, and pipeline filters that enable the insertion of custom HTTP handlers into the pipeline. The Windows SDK includes sample filters for metered networks, OAuth authentication, and more.
63+
A Windows Runtime HTTP client class modeled on the .NET Framework class of the same name in the System.Web namespace. `HttpClient` fully supports asynchronous upload and download over HTTP, and pipeline filters that enable the insertion of custom HTTP handlers into the pipeline. The Windows SDK includes sample filters for metered networks, OAuth authentication, and more. For apps that target only Universal Windows Platform, we recommend that you use the `Windows::Web:HttpClient` class.
5764

5865
[IXMLHTTPRequest2 interface](http://msdn.microsoft.com/library/windows/apps/hh831151.aspx)
5966
Provides a native COM interface that you can use in Windows Store apps or Windows desktop apps to connect to the Internet over HTTP and issue GET, PUT, and other HTTP commands. For more information, see [Walkthrough: Connecting Using Tasks and XML HTTP Requests](../parallel/concrt/walkthrough-connecting-using-tasks-and-xml-http-requests.md).

docs/cloud/cpp-rest-sdk-codename-casablanca.md

Lines changed: 0 additions & 34 deletions
This file was deleted.

docs/cpp-conformance-improvements-2017.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ translation.priority.ht:
2727
- "zh-cn"
2828
- "zh-tw"
2929
---
30-
30+
3131
# C++ conformance improvements in [!INCLUDE[vs_dev15_md](misc/includes/vs_dev15_md.md)]
3232

3333
## New language features
@@ -343,4 +343,5 @@ void f(ClassLibrary1::Class1 ^r1, ClassLibrary1::Class2 ^r2)
343343
}
344344
```
345345

346-
346+
## See Also
347+
[Visual C++ Language Conformance](visual-cpp-language-conformance.md)

docs/cpp/constexpr-cpp.md

Lines changed: 49 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,15 @@ translation.priority.ht:
3434
- "zh-tw"
3535
---
3636
# constexpr (C++)
37-
The keyword `constexpr` was introduced in C++11 and improved in C++14. It means *constant expression*. Like `const`, it can be applied to variables so that a compiler error will be raised if any code attempts to modify the value. Unlike `const`, `constexpr` can also be applied to functions and class constructors. `constexpr` indicates that the value, or return value, is constant and, if possible, will be computed at compile time. A `constexpr` integral value can be used wherever a const integer is required, such as in template arguments and array declarations. And when a value can be computed at compile time instead of run time, it can help your program can run faster and use less memory.
37+
The keyword `constexpr` was introduced in C++11 and improved in C++14. It means *constant expression*. Like `const`, it can be applied to variables so that a compiler error will be raised if any code attempts to modify the value. Unlike `const`, `constexpr` can also be applied to functions and class constructors. `constexpr` indicates that the value, or return value, is constant and, if possible, will be computed at compile time. A `constexpr` integral value can be used wherever a const integer is required, such as in template arguments and array declarations. And when a value can be computed at compile time instead of run time, it can help your program run faster and use less memory.
3838

3939
## Syntax
4040

4141
```cpp
42-
constexpr literal-type identifier = constant-expression;constexpr literal-type identifier { constant-expression };constexpr literal-type identifier(params );constexpr ctor (params);
42+
constexpr literal-type identifier = constant-expression;
43+
constexpr literal-type identifier { constant-expression };
44+
constexpr literal-type identifier(params );
45+
constexpr ctor (params);
4346
```
4447
4548
#### Parameters
@@ -64,8 +67,18 @@ constexpr literal-type identifier = constant-expression;constexpr literal-typ
6467
6568
## constexpr variables
6669
The primary difference between const and constexpr variables is that the initialization of a const variable can be deferred until run time whereas a constexpr variable must be initialized at compile time. All constexpr variables are const.
70+
71+
- A variable can be declared with `constexpr`, if it has a literal type and is initialized. If the initialization is performed by a constructor, the constructor must be declared as `constexpr`.
6772
68-
```
73+
- A reference may be declared as constexpr if the object that it references has been initialized by a constant expression and any implicit conversions that are invoked during initialization are also constant expressions.
74+
75+
- All declarations of a `constexpr` variable or function must have the `constexpr` specifier.
76+
77+
78+
79+
80+
81+
```cpp
6982
constexpr float x = 42.0;
7083
constexpr float y{108};
7184
constexpr float z = exp(5, 3);
@@ -75,9 +88,38 @@ constexpr int k = j + 1; //Error! j not a constant expression
7588
```
7689

7790
## constexpr functions
78-
A `constexpr` function is one whose return value can be computed at compile when consuming code requires it. A `constexpr` function must accept and return only literal types. When its arguments are `constexpr` values, and consuming code requires the return value at compile time, for example to initialize a `constexpr` variable or provide a non-type template argument, it produces a compile-time constant. When called with non-`constexpr` arguments, or when its value is not required at compile-time, it produces a value at run time like a regular function. (This dual behavior saves you from having to write `constexpr` and non-`constexpr` versions of the same function.)
91+
A `constexpr` function is one whose return value can be computed at compile when consuming code requires it. When its arguments are `constexpr` values, and consuming code requires the return value at compile time, for example to initialize a `constexpr` variable or provide a non-type template argument, it produces a compile-time constant. When called with non-`constexpr` arguments, or when its value is not required at compile-time, it produces a value at run time like a regular function. (This dual behavior saves you from having to write `constexpr` and non-`constexpr` versions of the same function.)
92+
93+
A `constexpr` function or constructor is implicitly `inline`.
94+
95+
The following rules apply to constexpr functions:
96+
97+
- A `constexpr` function must accept and return only literal types.
98+
99+
- A `constexpr` function can be recursive.
100+
101+
- It cannot be [virtual](../cpp/virtual-cpp.md). A a constructor cannot be defined as constexpr if the enclosing class has any virtual base classes.
102+
103+
- The body can be defined as `= default` or `= delete`.
104+
105+
- The body can contain no `goto` statements or try blocks.
106+
107+
- An explicit specialization of a non-constexpr template can be declared as `constexpr`:
108+
109+
- An explicit specialization of a `constexpr` template does not have to also be `constexpr`:
110+
111+
112+
<!--conformance note-->
113+
The following rules apply to constexpr functions in Visual Studio 2017 and later:
114+
115+
- It may contain if and switch statements, and all looping statements including for, range-based for, while, and do-while
116+
117+
- It may contain local variable declarations, but the variable must be initialized, must be a literal type, and cannot be static or thread-local. The locally-declared variable is not required to be const and may mutate.
118+
119+
- A constexpr non-static member function is not required to be implicitly const.
120+
79121

80-
```
122+
```cpp
81123
constexpr float exp(float x, int n)
82124
{
83125
return n == 0 ? 1 :
@@ -89,23 +131,7 @@ constexpr float exp(float x, int n)
89131
> [!TIP]
90132
> Note: In the Visual Studio debugger, you can tell whether a `constexpr` function is being evaluated at compile time by putting a breakpoint inside it. If the breakpoint is hit, the function was called at run-time. If not, then the function was called at compile time.
91133
92-
## General constexpr rules
93-
For a function, variable, constructor or static data member to be defined as `constexpr`, it must meet certain requirements:
94-
95-
- A `constexpr` function can be recursive. It cannot be [virtual](../cpp/virtual-cpp.md), and its return type and parameter types must all be literal types. The body can be defined as `= default` or `= delete`. Otherwise it must follow these rules: it contains no `goto` statements, try blocks, unitialized variables, or variable definitions that are not literal types, or that are static or thread-local. Additionally, a constructor cannot be defined as constexpr if the enclosing class has any virtual base classes.
96-
97-
- A variable can be declared with `constexpr`, if it has a literal type and is initialized. If the initialization is performed by a constructor, the constructor must be declared as `constexpr`.
98-
99-
- A reference may be declared as constexpr if the object that it references has been initialized by a constant expression and any implicit conversions that are invoked during initialization are also constant expressions.
100-
101-
- All declarations of a `constexpr` variable or function must have the `constexpr` specifier.
102-
103-
- An explicit specialization of a non-constexpr template can be declared as `constexpr`:
104-
105-
- An explicit specialization of a `constexpr` template does not have to also be `constexpr`:
106-
107-
- A `constexpr` function or constructor is implicitly `inline`.
108-
134+
109135
## Example
110136
The following example shows `constexpr` variables, functions and a user-defined type. Note that in the last statement in main(), the `constexpr` member function GetValue() is a run-time call because the value is not required to be known at compile time.
111137
@@ -182,4 +208,4 @@ int main()
182208
183209
## See Also
184210
[Declarations and Definitions](../cpp/declarations-and-definitions-cpp.md)
185-
[const](../cpp/constexpr-cpp.md)
211+
[const](../cpp/const-cpp.md)

docs/cpp/initializers.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ int main() {
388388
389389
- no virtual member functions
390390
391-
- no brace-or-equal initializers for non-static members
391+
> [!NOTE]
392+
> <!--conformance note-->In Visual Studio 2015 and earlier, an aggregate is not allowed to have brace-or-equal initializers for non-static members. This restriction was removed in the C++14 standard and implemented in Visual Studio 2017.
392393
393394
Aggregate initializers consist of a braced initialization list, with or without an equals sign, as in the following example:
394395
@@ -435,7 +436,7 @@ myArr3: 8 9 10 0 0
435436
```
436437

437438
> [!IMPORTANT]
438-
> Array members that declared but not explicitly initialized during aggregate initialization are zero-initialized, as in `myArr3` above.
439+
> Array members that are declared but not explicitly initialized during aggregate initialization are zero-initialized, as in `myArr3` above.
439440

440441
#### Initializing unions and structs
441442
If a union does not have a constructor, you can initialize it with a single value (or with another instance of a union). The value is used to initialize the first non-static field. This is different from struct initialization, in which the first value in the initializer is used to initialize the first field, the second to initialize the second field, and so on. Compare the initialization of unions and structs in the following example:

0 commit comments

Comments
 (0)