Visual Studio “14” CTP
Today, the Visual Studio “14” CTP was released. Soma writes all about it on his blog. Go ahead and click over to read the article, especially the section on Visual C++ conformance updates with an updated conformance roadmap.
Here are the improvements for Visual C++:
- Generalized lambda capture: You can assign the result of evaluating an expression to a variable in the capture clause of a lambda. This allows an instance of a move-only type to be captured by value.
- User-defined literals in the language and standard library: You can append numeric and string literals with meaningful suffixes to give them suitable semantics. The compiler transforms these suffixes into calls to appropriate UDL-operator functions. The <chrono>, <string>, and <complex> headers now provide literal operators for convenience. For example, “1729ms” means std::chrono::milliseconds(1729), “meow”s means std::string(“meow”), and 3.14i means std::complex<double>(0.0, 3.14).
- Completed noexcept: You can check whether an expression will throw an exception by using the noexcept operator. For example, noexcept(func()) will return “true” if func was specified as noexcept.
- Inline namespaces: You can specify a nested namespace as “inline” to make its contents accessed from its parent namespace.
- Thread-safe “magic” statics: Static local variables are initialized in a thread-safe way, removing the need for manual synchronization. Be aware that usage of these variables other than initialization is still not protected. Thread safety can be disabled by using /Zc:threadSafeInit- to avoid a dependency on the CRT.
- Unrestricted unions: You can define unions that contain types with non-trivial constructors. Constructors for such unions have to be manually defined.
- Includes November 2013 compiler CTP features: All new C++ 11 and C++ 14 language features that are released in the November 2013 compiler CTP for Visual Studio 2013 are also included in this preview. Go here for all the details.
- Null forward iterators: The Standard Library’s forward iterators (and stronger) now guarantee that value-initialized iterators compare as equal. This makes it possible to pass an empty range without a parent container. Be aware that generally, value-initialized iterators still cannot be compared to iterators from a parent container.
- quoted(): These manipulators let iostreams preserve strings that contain spaces.
- Heterogeneous associative lookup: When it is Enabled by special comparators (such as the less<> and greater<> transparent operator functors), the ordered associative containers gain templated lookup functions. This lets them work with objects that are comparable to keys, without actually constructing keys.
- integer_sequence: Compile-time integer sequences are now supported to make template metaprogramming easier.
- exchange(): This small utility function makes it convenient to assign a new value to an object and retrieve the old value.
- get<T>(): This lets a tuple element be accessed by its type (when unique) instead of by its index.
- Dual-range equal(), is_permutation(), mismatch(): C++98’s “range-and-a-half” algorithms that are taking (first1, last1, first2) are difficult to use correctly. While they are still provided, C++14 has added overloads taking (first1, last1, first2, last2) which are significantly easier and safer to use.
- tuple_element_t: This alias template is added for convenience and consistency with the type traits alias templates.
- Filesystem “V3” Technical Specification (TS): The interface and implementation of <filesystem> are overhauled to follow this TS, which is likely to be incorporated into C++17.
- Library Issues: 24 resolutions have been implemented (for example, is_final, make_reverse_iterator()), not including the resolutions that were already implemented in Visual C++ 2013. Notice that a library issue is a bug report for the Standard. It can be resolved by fixing a specification problem or even adding a small feature.
- <chrono> fixes: The clocks are rewritten to be conformant and precise.
- Minimal allocator fixes: Several library components (including basic_string and std::function) did not work with user-defined allocators implementing C++11’s minimal allocator interface, instead requiring C++03’s verbose allocator interface. All occurrences of this problem are fixed.
- C99 library features: Most of the remaining C99 library features are implemented. snprintf is implemented, the printf and scanf families of functions now support the new C99 format string improvements, the strtod and scanf families of functions now support hexadecimal floating-point and library conformance is better improved by software updates and adjustments.
- __restrict: The __restrict keyword is now supported on reference types in addition to pointer types.
- Improved diagnostics: The compiler will now emit warnings about suspicious code that previously would not have resulted in warnings. For example, shadowed variables will now cause warnings. Warnings have also been made clearer.
- The /Wv flag: You can use /Wv:XX.YY.ZZZZ to disable warnings that are introduced after compiler version XX.YY.ZZZZ. Notice that the emitted warnings may still differ from those emitted by the specified version.
- Compiler software updates: We have fixed more than 400 bugs in the compiler. 179 of these were submitted by users through Microsoft Connect.
- Refactored C Runtime (CRT): This CTP contains the first preview of the substantially refactored CRT. msvcr140.dll no longer exists. It is replaced by a trio of DLLs: vcruntime140.dll, appcrt140.dll, and desktopcrt140.dll.
- stdio performance: Many performance improvements are made in the stdio library, notably in the sprintf and sscanf families of functions.
- Object file size reductions: Working together with compiler fixes, the STL’s headers are changed to significantly reduce the sizes of object files and static libraries (that is after compilation but before linking. The sizes of linked EXEs/DLLs are unaffected). For example, when you compile a source file that includes all C and C++ Standard Library headers and does nothing else with them, for x86 with /MD /O2, Visual C++ 2013 generated a 731 KB object file. This is improved to be less than 1 KB.
- Debug checking fixes: The STL’s debug checks rejected null pointers that are passed as iterators, even when the Standard guaranteed that they should work (for example, merging two [null, null) ranges to a null output). Every algorithm is inspected and fixed.
- Create declaration or definition: You can quickly create a function’s declaration or definition in relation to its neighbors. To do this, right-click the declaration or definition, or use SmartTags.
- Debugger visualizers: Natvis debugger visualization files can be added to a Visual C++ project for easy management and source control integration. Natvis files that are added to a project will take evaluation precedence over visualizers outside the project.
Native memory diagnostics:
- You can start a memory diagnostic session (Alt+F2) that monitors the live memory usage of your native application. This supports Windows Desktop.
- You can capture heap snapshots of the running process in memory to see the types and instances for native allocations.
- You can view the difference in memory allocations between two memory snapshots.
- You can dive into the memory contents of a process snapshot by using the debugger for deeper analysis of the heap.
To view the entire release notes, known issues, and installation requirements go here.
Known issues include:
- Expression evaluation fails during native memory diagnostics when the Just My Code setting is turned on. Turning off this setting will allow expression evaluation to work correctly.
- New Visual C++ language features in this release do not have full IntelliSense support in the Visual Studio editor.
- The noexcept operator may fail in scenarios that are involving complex templates.
- Currently, user-defined literals may generate incorrect code under /CLR. Extremely large literals are not yet supported.
- Code Analysis is not supported in this release of the compiler. If you try to build by using /analyze, the compiler will issue a warning and ignore the flag.
- Building Windows Phone 8.1 apps by using Visual C++ is not yet supported.
- Windows Store 8.1 applications that are written in Visual C++ built by using this preview compiler would not be validated by the Windows App Certification Kit, and these applications would rely on the Desktop DLLs instead of the “_app” versions of the DLLs which are used exclusively by Store applications. This will be rectified in future releases.
Remember that this is a CTP and is not meant for production environments.
We are proud of this CTP and want to thank you for your ongoing feedback, positive and not so positive. Look for new articles about CTP features this week and most of next week from folks on the Visual C++ team.
Please try the Visual Studio “14” CTP and give us your feedback. Report bugs using Connect and share your suggestions through Send-a-Smile from within the IDE or on our UserVoice site. You can also leave your comments below.