VC++ Bytes 2-2: New Front-End Compiler Features with Karl Niu

Play VC++ Bytes 2-2: New Front-End Compiler Features with Karl Niu
Sign in to queue


Fellow C++ PM Karl Niu provides an impressive series of demos showcasing new compiler features in Visual Studio "14".

Use the following guide to quickly access the features you'd like to review:
[01:20] Thread safe statics
[04:05] Inline namespaces
[07:59] noexcept
[10:02] Unrestricted unions
[11:48] User-defined literals (UDLs)
[13:04] Generalized lambda capture 

Visit this page to download your own (free) copy of Visual Studio "14" containing all these features and more!



Download this episode

The Discussion

  • User profile image

    all of them are super useful ! especially thread safe static init and noexcept !

  • User profile image

    @Karl: Thanks for the informative survey. (I just wish the fonts were larger.. or maybe I'm just getting old)

    Pardon me for hijacking this to a different topic, but I have no other way to reach you and I suspect Connect doesn't mail you on follow-ups:  Would you kindly take a second look at this bug?  I might have failed to explain the impact in the original report, so i've done so extensively here.

  • User profile image
    Ying Chi

    Dear @Karl, I seek technical support for Visual Studio C++ debug.

    I am using Visual Studio C++ to program, and felt the debugging is really difficult. For example, to check the values in a large 3D matrix, it takes me long time to unfold rows or columns one by one…
    Is there any methods or assisting tools can help us make the VC++ debug very easy, very beautiful, like using Matlab. That really can make life happier.

    Some friend said .Net can help, but didn't tell me how;
    Some said Matlab has the capability of supporting, also did not tell me how;
    Some said other visual tools like array visualizer extension, and/or arraydebugviewer can be used, is this true? how to install and combine them?

    Appreciate much your great help in advance!

  • User profile image
    David Lowndes

    For the unrestricted unions feature, the error C2280 (I think that was the number shown in the video), "attempting to reference a deleted function" - is far from self-explanatory. Why can't it say something more specific like "Union needs a constructor for non-trivial member constructor"?

  • User profile image

    Good stuff coming, thanks for the demo. A larger font size would help a lot in future videos.

    I agree with David L. -- a much better error message should be possible with the missing ctor.

  • User profile image

    @schroedl:Excellent point on the font size; I'll be sure to zoom into the editor for future videos!

    I'll get Karl to address the other comment =)

  • User profile image

    @David Lowndes:

    The standard mandates that we must use deleted functions (read this) to enforce the constructor definition requirement for unions with members that have non-trivial constructors. This is why the error message refers not to unions, but to an implicitly used language mechanism. We could  insert an additional message specific to the unrestricted union case to help novice users, but this would clutter the compiler's output for more advanced users, who can easily deduce why the constructor was deleted by looking at the definition of the union.

    @Ofek_Shilon: Sorry for taking a while. We will respond to you on Connect.

    @Ying Chi: I am not very familiar with the debugger myself and so cannot help you much on this subject. Have you tried contacting the debugger team directly via Send-a-Smile/Frown or Connect?

  • User profile image
    David Lowndes

    One of the reasons that many developers think C++ is hard is often because the compiler error messages are awful. This is such an example. Do not assume we're all intimately familiar with the nitty gritty details of the C++ standardize - we're not. Please give us as much useful information to help us find our mistakes. Do you want a Connect bug/suggestion report on this?

  • User profile image
    David Lowndes

    Add a vote to this if you think the error message shown in the demo for the unrestricted unions situation is pants.

  • User profile image

    @Ying Chi: On behalf of the debugger team:

    "Unfortunately, Visual Studio does not provide a way to view the contents of a matrix better than what you get by expanding it in the watch window.  If you want to see the data in its rows and columns, your best option is to write a helper function which dumps the contents of the matrix into a global string buffer, using whatever pretty format you desire.  You can then call the helper function from the watch window and use the string viewer (click the magnifying glass to the right of the 'value' column) to view the global string that the helper function populates."

    Also, "the traditional way to do better native visualizations for collections for the debugger is the natvis file:"

  • User profile image

    @YingChi: for watching a fixed-size (say, 3 by 3) matrices, I use this trick:

    The post is from the autoexp era, but it easily extends to natvis.

Add Your 2 Cents