C++ Brace Pair Colorization and More in Visual Studio -- Mryam Girmay

Mryam-G1-96x96.jpgVisual Studio has a host of new productivity features, which you can read about in this article.

C++ Brace Pair Colorization and More in Visual Studio

by Mryam Girmay

From the article:

You can now visually distinguish each set of opening and closing braces for your C++ code making it easier to see your code’s scope or find any missing braces. There will be different colors for curly braces, and the paired braces {} will have the same color, which will make it easy to visualize where the braces open and close especially when you have intensely nested codes. The feature is available for C++ today and will be coming to additional languages in subsequent releases.

Debug Linux Console apps in Visual Studio’s Integrated Terminal -- Sinem Akinci

Visual Studio now comes with support for debugging interactive console applications directly from the IDE.

Debug Linux Console apps in Visual Studio’s Integrated Terminal

By Sinem Akinci

From the article:

Now, using the Linux Console embedded in the Integrated Terminal, Visual Studio supports a fully functional terminal-like experience when debugging Linux applications. This new Linux Console emulates an xterm and can support application screen manipulation; for example, writing screen formatting control characters to stdout or using the ncurses library. Additionally, there is support for vt sequences and keyboard shortcuts such as Ctrl+C application interruption.

Abseil Strings Library -- Yury Fedorov

Let's talk a bit about one of the most used Abseil parts:

Abseil Strings Library

by Yury Fedorov

From the article:

Abseil is an open source solution from Google that implements many basic and very helpful construction blocks for C++. Thanks to Abseil you may create a great isolation layer from your version of C++ compiler. In this article I will focus on few common functions from one of the most used Abseil libraries: absl::strings.

VS Code C++ Extension January Update: Create Definitions and Declarations -- Alexandra Kemper

You can now create declarations from definitions and vice versa in Visual Studio Code.

VS Code C++ Extension January Update: Create Definitions and Declarations

by Alexandra Kemper

From the article:

Starting with the 1.13.6 version of the C++ Extension in VS Code, we are happy to share a much requested feature: Auto creation of definitions or declarations for functions! You can now quickly create a declaration in a header file for a function you only have a definition for, or vice versa. These generated definitions and declarations already include all function arguments, so no need for constant copying, pasting, and double checking.

Writing Native Win32 Applications with WinLamb and Modern C++ -- Richard Thomson

Utah C++ Programmers has released a new video:

Writing Native Win32 Applications with WinLamb and Modern C++

by Richard Thomson

From the video description:

The Win32 Windows API has been around for decades as a C API for GUI applications. At its heart, every Win32 application is a program that receives messages from Windows, decodes those messages and dispatches them to appropriate code for handling the message.

Graphical user interfaces are a natural fit for object oriented programming and C++ GUI frameworks like MFC (Microsoft Foundation Classes) were created to make writing GUI applications easier.

As Win32 applications evolved to incorporate COM (Component Object Model) objects, a need to write small components adhering to well defined interfaces became more important. Writing such components with MFC results in a heavyweight object and additional deployment dependencies. C++ libraries like ATL (Active Template Library) addressed the need to create interoperable binary components that were lightweight with minimal or no deployment dependencies.

The Windows Template Library (WTL) took the lessons learned from writing small COM objects with ATL and applied them to writing complete Win32 applications. The result is a complete library for writing Win32 applications using the static polymorphism of templates instead of the dynamic polymorphism of MFC.

Are there other ways to look at writing Win32 applications?

WinLamb is similar to WTL in that they are both header-only libraries that wrap the Win32 API. While a WTL program uses message map macros to select the appropriate handler for a message, WinLamb uses lambda functions for the message handlers and an internal dispatching mechanism.

This month, Richard Thomson will give us a walk through of using WinLamb to create Win32 applications. We'll look at how to create an application from scratch with CMake and using the project wizard in Visual Studio. (Since our application isn't cross-platform, but Windows only, we won't lose anything by using Visual Studio's wizard.)

From this skeleton application, we'll look at:

  • how to add message handlers to the main window
  • how to add controls to the main window
  • how to define and use resources
  • how to use a dialog box as the main window
  • how to separate GUI logic from application logic
  • Win32 API helpers provided by WinLamb

https://www.youtube.com/watch?v=2K52YX-vHv4

The C++ Language: Present and Future -- Daniel Garcia

This year we had a wonderful C++ start at Universidad Carlos III de Madrid. The Department of Computer Science and Engineering was honored to have Prof. Bjarne Stroustrup giving a seminar on C++ to start the semester.

We are always happy to have Bjarne Stroustrup with us. Since 2019 he holds a Honorary Doctorate by Universidad Carlos III de Madrid and he has visiting us several times.

Both talks were very well attended with a nice mix of professional developers from industry, students (bachelor, masters and PhD) and researchers and professors from several different departments.

This is a short summary of the two talks he gave:

Day 1: C++ 20: Reaching the aims of C++.

About the video

Out of necessity C++ has been an evolving language. I outline some early ideals for C++, some techniques for keeping the evolution directed, and show how C++20 comes close to many of those ideals. Specific topics ncludes type-and-resource safe code, generic programming, modularity, the elimination of the preprocessor, and error handling. Naturally, over the years, C++ has acquired many “barnacles” that can become obstacles to developing elegant and efficient code. That has been a recognized problem since the early days of C – Dennis Ritchie and I talked about it – so we must distinguish between what can be done and what should be done. The C++ Core Guidelines is the current best effort in that direction.

Day 2: Type-and-resource Safe programming in ISO Standard C++.

About the video

You can write C++ with no violations of the type system, no resource leaks, no memory corruption, no garbage collector, no limitation of expressiveness or performance degradation compared to well-written modern C++. This talk show how this can be achieved – and guaranteed – by the applying the C++ Core Guidelines, simple supporting libraries (mostly the ISO C++ standard library), and static analysis.

Many examples demonstrate how this can be done with code that’s dramatically simpler than older C++ (and C) code. This talk will touch upon RAII, type deduction, span, range checking, nullptr, initialization, invalidation,  casting and variants.


 

Review of Embracing Modern C++ Safely (Lakos, Romeo, Khlebnikov, Meredith) -- Bartlomiej Filipek

embcpp_small.jpgThe "Safely Tome" has landed, and we have a review from the author of C++ Stories:

Review of Embracing Modern C++ Safely (Lakos, Romeo, Khlebnikov, Meredith)

by Bartlomiej Filipek

From the review:

C++11 has been around for around 11 years and C++14 for 8. From my experience, I see that even today, many companies struggle to use those standards in production in the most efficient way. As always, with new stuff came benefits, risks, and increased learning effort. Fortunately, with a new book written by top C++ Experts, we have a solid guide on what is safe and what might be problematic in Modern C++.

The book is called “Embracing Modern C++ Safely”.

Let’s see what’s inside...

Overload 173, February 2023

overload173cover.pngOverload #173 is now available!

Highlights include:

  • Floating-Point Comparison  WEB  PDF
    By Paul Floyd
    Comparing floating point values can be difficult. Paul Floyd shows how you should perform floating-point comparisons (and how not to do it).

 

  • Determining If A Template Specialization Exists  WEB  PDF
    By Lukas Barth
    How do you tell if a class or function template can be used with specific arguments? Lukas Barth details his approach.

 

  • Stack Frame Layout On x86-64  WEB  PDF
    By Eli Bendersky
    Stacks can have different layouts. Eli Bendersky describes the x86-64 layout in detail.

 

  • Value-Oriented Programming  WEB  PDF
    By Lucian Radu Teodorescu
    The research Val programming language uses value-oriented programming. Lucian Radu Teodorescu explores this paradigm.

C++23 “Pandemic Edition” is complete -- Herb Sutter

image.pngC++23 is done!

C++23 "Pandemic Edition" is complete (Trip report: Winter ISO C++ standards meeting, Issaquah, WA, USA)

by Herb Sutter

From the article:

On Saturday, the ISO C++ committee completed technical work on C++23 in Issaquah, WA, USA! We resolved the remaining international comments on the C++23 draft, and are now producing the final document to be sent out for its international approval ballot (Draft International Standard, or DIS) and final editorial work, to be published later in 2023...

... Per our published C++23 schedule, this was our final meeting to finish technical work on C++23. No features were added or removed, we just handled fit-and-finish issues and primarily focused on finishing addressing the 137 national body comments we received in the summer’s international comment ballot (Committee Draft, or CD). You can find a list of C++23 features here, many of them already implemented in major compilers and libraries. C++23’s main theme was “completing C++20,” and some of the highlights include module “std”, “if consteval,” explicit “this” parameters, still more constexpr, still more CTAD, “[[assume]]”, simplifying implicit move, multidimensional and static “operator[]”, a bunch of Unicode improvements, and Nicolai Josuttis’ personal favorite: fixing the lifetime of temporaries in range-for loops...