Category Archive for Microsoft

Microsoft Visual C++ STL is C++20 Feature Complete

Microsoft just announced that their STL included with Visual C++ is now C++20 feature complete. This is the case for:

  • Visual Studio 2022 version 17.2
  • Visual Studio 2019 version 16.11.14

All C++20 features are now available under the /std:c++20 compiler flag.

You can read the full announcement here.

Share

Visual Studio 2019 Preview 2 Improvements

The recently released Preview 2 of Microsoft Visual Studio 2019 contains quite a few improvements and new features.

Lifetime Profile Checker

Preview 2 includes a Lifetime Profile Checker that implements the Lifetime Profile as published by the C++ Core Guidelines. It includes:

  • Support for iterators, string_views, and spans.
  • Better detection of custom Owner and Pointer types which allows custom types that behave like Containers, Owning-Pointers, or Non-Owning Pointers to participate in the analysis.
  • Type-aware default rules for function call pre and post conditions help reduce false-positives and improve accuracy.
  • Better support for aggregate types.
  • General correctness and performance improvements.
  • Some simple nullptr analysis.

This feature is not enabled by default, but you can enable it in the code analysis ruleset for your project. An example of what this checker can catch is the following in which we have a dangling string_view:

std::string get_string();
void dangling_string_view()
{
    std::string_view sv = get_string();
    auto c = sv.at(0);
}

You can read more about this feature here.

Backend Updates: New Optimizations, OpenMP, and Build Throughput improvements

New features include:

  • Added a new inlining command line switch: -Ob3. -Ob3 is a more aggressive version of -Ob2.
  • Added basic support for OpenMP SIMD vectorization.
  • Added a new C++ exception handler __CxxFrameHandler4 that reduces exception handling metadata overhead by 66%.
  • Support for Short Vector Math Library (SVML) intrinsic functions.

New and improved optimizations include:

  • Useless struct/class copies are being removed in several more cases, including copies to output parameters and functions returning an object. This optimization is especially effective in C++ programs that pass objects by value.
  • Unrolled memsets and block initializations will now use SSE2 instructions (or AVX instructions if allowed).
  • The compiler recognizes memmove() as an intrinsic function and optimizes accordingly.
  • Several new scalar fused multiply-add (FMA) patterns are identified with /arch:AVX2 /fp:fast.

Preview 2 also improves build throughput. Link times might be improved up to 2x.

The new linker will now report potentially matched symbol(s) for unresolved symbols, like:

main.obj : error LNK2019: unresolved external symbol _foo referenced in function _main
  Hint on symbols that are defined and could potentially match:
    "int __cdecl foo(int)" (?foo@@YAHH@Z)
    "bool __cdecl foo(double)" (?foo@@YA_NN@Z)
    @foo@0
    foo@@4
main.exe : fatal error LNK1120: 1 unresolved externals

More details can be found on this blog post.

Template IntelliSense Improvements

The following updates for Template IntelliSense are included with Preview 2:

  • Peek Window UI
  • Live Edits
  • Nested Template support
  • Default Argument watermarks

Read all about it on this blog post.

C++ Productivity Improvements

Preview 2 comes with the following new quick fixes and code navigation improvements:

  • Quick fixes for:
    • Add missing #include
    • NULL to nullptr
    • Add missing semicolon
    • Resolve missing namespace or scope
    • Replace bad indirection operands (* to & and & to *)
  • Quick Info on closing brace
  • Peek Header / Code File
  • Go to Document on #include

Read more about this new features here.

New Code Analysis Checks

Preview 2 includes new code analysis checks:

  • Use-after-move checker
  • Coroutine related checkers

Read more about them here.

In-editor Code Analysis Improvements

Code analysis now runs automatically in the background, and warnings display as green squiggles in-editor. Analysis re-runs every time you open a file in the editor and when you save your changes.

Squiggles are improved. Squiggles are now only displayed underneath the code segment that is relevant to the warning.

Read more here.

Share

Visual Studio 2017 version 15.9 Released

Microsoft has release version 15.9 of Visual Studio 2017. This update includes a few interesting new additions for C++ developers. From their VC++ release notes:

  • We’ve added the “step back” feature in the debugger for C++ in the Visual Studio Enterprise Edition. Step back enables you to go back in time to view the state of your application at a previous point in time.
  • C++ IntelliSense now responds to changes in the remote environment for both CMake and MSBuild projects targeting Linux. As you install new libraries or change your CMake projects, C++ IntelliSense will automatically parse the new headers files on the remote machine for a complete and seamless C++ editing experience.
  • We’ve updated the UWP Desktop Bridge framework packages to match the latest in the Windows Store for all supported architectures, including ARM64.
  • In addition to fixing 60 blocking bugs, we have added support for the range-v3 library with the MSVC 15.9 compiler, available under /std:c++17 /permissive-.
  • The retail VCLibs framework package in Visual Studio has been updated to match the latest available version in the UWP Store.
  • Full support is now available for ARM64 C++ Native Desktop scenarios, including VC++ 2017 Redistributable.
  • We implemented the shortest round-trip decimal overloads of floating-point to_chars() in C++17’s charconv header. For scientific notation, it is approximately 10x as fast as sprintf_s() “%.8e” for floats, and 30x as fast as sprintf_s() “%.16e” for doubles. This uses Ulf Adams’ new algorithm, Ryu.
  • A list of improvements to the standards conformance of the Visual C++ compiler, which potentially require source changes in strict conformance mode, can be found here.

You can find the full release notes here.

Share

Visual Studio 2017 Released

Slides of my CppCon 2016 Presentation “Mobile App Development for Multiple Platforms with Visual C++, 2016″

On September 22th, 2016 I gave a presentation titled “Mobile App Development for Multiple Platforms with Visual C++, 2016” at CppCon 2016.
The slides of my presentation can be downloaded below:


Looking forward to next year’s edition of CppCon, which has been announced to be on September 25th-29th in Bellevue, Washington 🙂

Share

Performance Improvements with Visual Studio 2015 Update 2

Visual Studio 2015 Update 2, released on March 30 2016, brought a couple of performance improvements.

  • Enabled a new database engine; now, C++ Project load should be faster and experience fewer UI delays.
  • Increased the speed of extracting floating-point numbers with iostreams (in other words, “stream >> dbl”). It’s now up to 19x faster, and all bits of the extracted value are now correct.
  • Increased the speed of std::vector reallocation and std::copy(); they are up to 9x faster as they call memmove() for trivially copyable types (including user-defined types).
  • Increased the speed of std::vector, which is up to 11x faster.
  • Increased the speed of std::string::replace(), which is enormously faster when replacing same-size substrings.
  • Increased the speed of std::string::push_back(), which is up to 3x faster.
  • Increased the speed of std::sub_match comparisons, as they now avoid constructing temporary std::strings.
  • Increased the speed of std::function’s copy constructor; it is slightly faster with a reduced codegen size.

The full official release notes can be found here.

Share

Milestone: VS 2015 Update 2’s Standard Library is C++11, C++14, and C++17-so-far Feature Complete

The C++ Standard Library in the Visual Studio 2015 Update 2 release is C++11, C++14, and C++17-so-far feature complete. This includes all features from C++17 that are currently in that standard proposal: SFINAE-friendly result_of, improvements to pair and tuple, shared_mutex, removal of deprecated iostreams aliases, variable templates for type traits (is_same_v, …), as_const(), logical operator type traits (conjunction, …), owner_less<>, variadic lock_guard, and additions to <chrono>: floor(), ceil(), round(), and abs().
More information, including a detailed list can be found here.

Share

Videos are online of the Windows 10 Dev Day Belgium

The Windows 10 Developer Day brought together more than 300 developers across 3 locations in Belgium (Brussels, Hasselt and Gent). The sessions in Hasselt were recorded and are now available online.

Dive into the benefits that come with the Universal Windows Platform and learn how to have your app run on any device regardless of screen size.

Be amazed about the ease of making the web work for you on Windows 10. Get to know the advantages of building a cloud-connected, mobile experience and see for yourself what the future computing looks like!

Watch the videos on Channel 9.

Share

Slides of my CppCon 2015 Presentation “Cross Platform Mobile App Development in VC++2015”

On September 22th, 2015 together with Ankit Asthana from Microsoft I gave a presentation titled “Cross-Platform Mobile App Development with Visual C++ 2015” at CppCon 2015.
The slides of our presentation can be downloaded below:


Looking forward to next year’s edition of CppCon 🙂

Share

VC++ 2015 RC Includes a Dynamic Dialog Layout Feature

The VC++2015 Release Candidate includes an extremely long overdue new feature for MFC: Dynamic Dialogs.

It’s now finally possible to define how controls should move and resize when an MFC dialog is resized. The behavior can be configured with the dialog resource editor.

Artur Laksberg has written an article about the new feature.


Share

C++11/14/17 Features In VS 2015 RC

Stephan T. Lavavej has published an updated table detailing the C++11/14/17 support in VC++ 2015 RC.

Already quite a few C++17 features are included.

Read it here.

Share

Visual C++ 2015 – Speeding up the Incremental Developer Build Scenario

Ankit Asthana published an interesting blog post on the Visual C++ Team Blog about Speeding up the Incremental Developer Build Scenario.
The developer incremental scenario is one where a developer changes a single or multiple source files (while fixing bugs) and builds. This scenario for Visual C++ is roughly equivalent to the amount of time spent in linking the executable (.dll or .exe).
The blog post discusses the following new features:

  • Incremental Linking for Static Libraries (/incremental linker switch)
  • /Zc:inline and Algorithmic improvements (/Zc:inline compiler switch, 2X Faster Links)
  • Fast Program Database (PDB) generation (/debug:FASTLINK linker switch, 2X Faster Links)
  • Incremental Link Time Code Generation (iLTCG) (/LTCG:incremental linker switch, 4x faster links)

It’s definitely worth reading his post, it includes some impressive benchmarks 🙂

Share

Visual C++ 2015 – Resumable Functions

Visual C++ 2015 includes a general purpose solution to implement resumable functions based on the concept of coroutines. A coroutine is a generalized routine entity which supports operations like suspend and resume in addition to the traditional invoke and return operations.
These resumable functions are being proposed for inclusion in ISO C++17.
For the VC++ 2015 Preview, the feature only works for 64-bit targets, and requires adding the /await switch to your compiler command-line.
Such resumable functions have several use cases:

  • Asynchronous operations
  • Generator pattern
  • Reactive Streams

Here is a simple example demonstrating an asynchronous operation:

#include <future>
#include <thread>
#include <experimental\resumable>

using namespace std; 
using namespace std::chrono; 
  
// this could be some long running computation or I/O
future<int> calculate_the_answer() 
{ 
    return async([] { 
        this_thread::sleep_for(1s); return 42; 
    }); 
} 
  
// Here is a resumable function
future<void> coro() { 
    printf("Started waiting... \n"); 
    auto result = __await calculate_the_answer(); 
    printf("got %d. \n", result); 
} 
  
int _tmain(int argc, _TCHAR* argv[]) 
{ 
    coro().get(); 
}

The important line here is line 17. The function calculate_the_answer() is an asynchronous function which immediately returns by returning a future. Thanks to the __await keyword on line 17, the rest of the coro() function can be implemented as if you are simply programming synchronously! No need anymore to mess around with task continuations or what not. This makes asynchronous programming much easier 😀

Read the full explanation here.

Share

Visual Studio 2015 Preview

Microsoft has released a preview of Visual Studio 2015.
There are a lot of C++ changes included in this preview. You can read the full release notes here.

Here is a short version quoted from a blog post from Eric Battalio from Microsoft:

  • C++ Cross-Platform Mobile Development. C++ is attractive because it offers portability and a chance to reuse the same code on different platforms. With Visual Studio 2015 Preview, modern application developers can use the Visual C++ tool chain (c1xx, c2) to target Microsoft Windows Platforms and Clang / LLVM for targeting Android (with plans to support iOS in the near future). This makes it even easier to re-use existing C++ libraries to target multiple platforms (Android/Windows/iOS), share cross-platform code, and create high-quality Xamarin Native Android and Native-Activity applications using all of the power of Visual Studio. For a closer look, see Cross-Platform Mobile Development with Visual C++.
  • C++11, C++14, C++17 (proposed) compatibility. Standards support across compilers improves portability. With Visual Studio 2015 Preview, Visual C++ is even more compliant with user-defined literals (C++11), generic lambdas (C++14), and await (C++17 proposed). For a view of VS conformance in table form, see this post by Stephan Lavavej (STL). Also check out Details About Some of the New C++ Language Features, Improvements to Warnings in the C++ Compiler, and Resumable Functions in C++.
  • Enhanced productivity & build-time improvements. “Productivity” and “C++” are not often used in the same sentence except to criticize some aspect of the IDE, build process or diagnostics. Friction in any of these areas slows down the development process. With Visual Studio 2015 Preview, you get improvements in each including refactoring for C++ and improved IntelliSense database buildup and simplified QuickInfo for template deduction (IDE); incremental linking for static libs, new fast PDB generation techniques, multithreading in the linker (build); and dedicated space for analyzing graphics space using the Visual Studio Graphics Analyzer (VSGA) and you can view the impact of shader code changes without re-running the app (diagnostics). For more details about incremental build, see Speeding up the Incremental Build Scenario.
  • Improved performance. Most of the C++ developers we spoke with needed code to run fast, often as part of intensive data transformation or analysis or real-time control. Visual Studio 2015 Preview builds on the AVX2 support in Visual Studio 2013 to bring more general optimizations like loop-if unswitching, Vectorization of control flow, and increased support for Vectorization (including when optimizing in favor of smaller code). In addition we have a number of ARM32 compiler code generation improvements.

 
See Eric’s blog post here for a couple more links.
Download the Visual Studio 2015 Preview.

Share

Visual Studio Community 2013

Microsoft announced the availability of Visual Studio Community 2013.
This Community edition replaces the Express editions.
You no longer have to decide which Express edition to use because the Community edition supports all kinds of development, web, mobile, desktop, …
Visual Studio Community 2013 includes all the functionality of Visual Studio Professional 2013.
Unlike the Express editions, the Community edition supports extensions.

Of course there are some restrictions on who can use this edition, but not many:

Here’s how individual developers can use Visual Studio Community:

  • Any individual developer can use Visual Studio Community to create their own free or paid apps.

Here’s how Visual Studio Community can be used in organizations:

  • An unlimited number of users within an organization can use Visual Studio Community for the following scenarios: in a classroom learning environment, for academic research, or for contributing to open source projects.
  • For all other usage scenarios: In non-enterprise organizations, up to 5 users can use Visual Studio Community. In enterprise organizations (meaning those with >250 PCs or > $1MM in annual revenue), no use is permitted beyond the open source, academic research, and classroom learning environment scenarios described above.

Download and get more information from here.

Share

C++14 STL Features, Fixes, And Breaking Changes In Visual Studio 14 CTP1

Stephan T. Lavavej, aka STL, has written a very detailed blog post describing new C++14 STL features, implemented fixes, and breaking changes in Visual Studio 14 CTP1. Read it here.

One notable breaking change is that containers cannot have const elements:

The Standard has always forbidden containers of const elements (e.g. vector, set). (C++98/03’s prohibition was crystal clear: elements must be Assignable, which const T isn’t. C++11/14’s prohibition is obscurely hidden, but it’s there.) Previously, VC accepted such containers due to non-Standard machinery in std::allocator. We’ve removed that machinery, so such containers now fail to compile.

Share

Visual Studio “14” CTP

Microsoft has released Visual Studio “14” CTP. You can read the announcement on Soma’s blog. Visual Studio “14” will most likely be available sometime in 2015.

Note: This is a CTP release, thus it should be installed in a test environment, such as a VM or a clean machine. Do not install on a machine with another version of Visual Studio installed.

Specifically for C++, there are quite a few improvements, such as:

  • Generalized lambda capture
  • User-defined literals in the language and standard library
  • Completed noexcept
  • Inline namespaces
  • Thread-safe “magic” statics
  • Unrestricted unions
  • All November 2013 compiler CTP features
  • Null forward iterators
  • quoted()
  • Heterogeneous associative lookup
  • integer_sequence
  • exchange()
  • get()
  • Dual-range equal(), is_permutation(), mismatch()
  • tuple_element_t
  • Filesystem “V3” Technical Specification (TS)
  • Object file size reductions
  • Debug checking fixes
  • Create declaration or definition
  • Native memory diagnostics
  • 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.

Read Eric’s blog for a bit more details on those improvements.

Download the CTP.

Share

Microsoft MVP VC++ 2014 Award

Today I got a mail from Microsoft saying that my MVP (Most Valuable Professional) award for Visual C++ is extended for 2014 🙂

Congratulations! We are pleased to present you with the 2014 Microsoft® MVP Award! This award is given to exceptional technical community leaders who actively share their high quality, real world expertise with others. We appreciate your outstanding contributions in Visual C++ technical communities during the past year.

See my MVP profile.

Share

My BeCPP Presentation “What’s new in Visual C++ 2013”

On Monday March 17th, 2014 I gave a “What’s new in Visual C++ 2013” presentation for the Belgian C++ Users Group (BeC++).
This time there were around 55 attendees for the BeC++ meeting, quite a success 🙂
The slides of my presentation can be downloaded below:

Peter Van Weert gave a presentation “What’s new in C++14”.
His slides can be downloaded from the official BeC++ blog.

There are also a couple of pictures from the event on the BeC++ blog.

And I already started planning the next Belgian C++ Users Group meeting. It will be on May 8th, 2014. Details will follow soon.

Share

C++ AMP Presentation for KLA Tencor / ICOS

Today I gave an introduction presentation on C++ AMP for software engineers and team leads of KLA Tencor / ICOS. The presentation was almost the same as I gave on Meeting C++ in November 2013.
The slides can be downloaded below:

Share