The C++ preprocessor is a text replacement tool used to transform the source code in order to produce a single text file that is then passed to the actual compiler. It has various capabilities, such as including files, conditional compilation, text macro replacement, error emitting, stringizing, or token concatenation. Often developers use the preprocessor when other alternatives are available and are more appropriate. In this article, I will show five examples of when and how you can avoid the use of the preprocessor.
In a previous post, I wrote about the C++ unit-testing framework Catch2. Catch uses another library, called Clara, for parsing command line arguments. Clara is an open-source, single-header, simple, composable and easy to use parser written by the author of Catch2. In this post, I will show how you can use Clara in C++ to parse command line arguments.
Here is my list of good reads from March.
In my book, Modern C++ Programming Cookbook, I discussed several testing frameworks for C++, more precisely, Boost.Test, Google Test, and Catch (which stands for C++ Automated Test Cases in a Header). Since the publishing of the book, a new version of Catch, called Catch2 has been released. This provides new functionalities, but also a series of breaking changes with Catch, including the drop of support for pre-C++11 compilers. For a list of changes, you can see the Catch2 release notes. Catch2 is available as a single-header library, is open-sources and cross-platform, and written for C++11/14/17/latest. In this article, I want to give a brief example of how you can write tests for C++ using Catch2.
A couple years ago I wrote a post called A better date and time C++ library about Howard Hinnant’s date library (I actually planned for several posts, but only the first was materialized). A slightly modified version of the library has been voted in for C++ 20 at the ISO committee meeting in Jacksonville this month. You can find the actual proposal here D0355R7: Extending <chrono> to Calendars and Time Zones.
curl is a project containing a command line tool and a library that can be used to transfer data using a variety of protocols, including, of course, HTTP and HTTPS. The library API is written in C, but there are various C++ wrappers on top of it. One of those is curlcpp. In this article, I will show how to build these libraries for Windows with Visual Studio.
I have recently submitted a proposal for a new standard library for universally unique identifiers. The library is called uuid and the paper, P0959R0 – A Proposal for a Universally Unique Identifier Library, is available on Github. The design of the library is inspired by the Boost Uuid Library and the Crossuuid library. I got lots of great feedback that shaped the formed of the proposal from people on the ISO C++ Standard – Future Proposals forum.
I used to have several open-source projects available on CodePlex. At the end of 2017, the site was put in read-only mode and it will probably be closed at some point. Therefore, I have decided to move the projects that could still be useful to GitHub.
Microsoft recently announced that it released version 15.5 of Visual Studio 2017 (and Visual Studio for Mac version 7.3). There are various improvements to performance and diagnostics (such as cutting the solution load times for large C# and VB projects by half), new features for C#, C++, F# development, and others. You can read the…
Four years ago I wrote a blog post that shown how to build a web server using the http_listener from the C++ REST SDK library as well as a client application that consumed the exposed resources. Over the years there have been various changes to the API from the library and some readers complained the…