March 2019

Formatting user-defined types with {fmt} library--Wojtek Gumuła

The future.

Formatting user-defined types with {fmt} library

by Wojtek Gumuła

From the article:

C++ has two standardized ways of printing formatted text out already: printf-family functions inherited from C and I/O streams abstraction built on operator<<. Streams are considered more modern, providing type-safety and extensibility functionalities. However, printf have some notable advantages, too — at the cost of lost type-safety, user can use an interface that looks familiar to almost all developers, allowing for some ways of localization and more readable syntax. And then, there is {fmt} — yet another text formatting library, inspired by design already available in languages like Python and Rust...

Quick Q: Implicit conversion and operator overload

Quick A: it tries to convert to int.

Recently on SO:

Implicit conversion and operator overload

In comparing the conversions needed by different overloaded functions, a "promotion" is considered a better conversion sequence than a standard "conversion". Every arithmetic type can promote to at most one other type. (Promotions are also used when passing an argument to a C-style variadic function like printf. The unary + operator can be used to force a promotion of an arithmetic expression, like +n.)

For integer types which are not character types or bool, the promoted type is:

  • If int can represent all the values of the original type, then int;
  • Otherwise, if unsigned int can represent all the values of the original type, then unsigned int;
  • Otherwise, the original type itself (promotion does nothing)

In your example, when comparing the overloaded functions, an "exact match" would be best, but there is no function taking exactly int8_t (or int8_t& or const int8_t&). The promoted type of uint8_t is int, since it's required to support a range much larger than 0-255. And apparently on your system, int32_t is an alias for int, so the function void f(int32_t); requires only a promotion on the argument. The other functions are all viable, but require an integer conversion on the argument. So void f(int32_t); is considered the best overload.

So the technical answer to the question is that it is implementation specific, but only because of the relationship between int and the <cstdint> types, not because of the overload resolution rules.

Kona: Trip Report -- Guy Davidson

The committee met in Kona, Hawai'i recently; here's a trip report.

Telescopes, matrices and audio: Kona trip report

by Guy Davidson

From the article:

As we stopped and parked among the telescopes, wandering from building to building, we realised that there was probably plenty of C++ code executing behind the doors of the observatories. We are never far from our trade.

Conan.io: Package management in C++

Diego Rodríguez-Losada is interviewed about Conan.io

Package management in C++

by Andrew Nesbitt and Alex Pounds

Though a bit outdated because it was recorded 9 months ago, still or, in fact, more than valid knowledge about tooling in C++. From the excerpt: We talk about what inspired the development of Conan, package management problems specific to C/C++ package management and the plans for the future.

 

CppCast Episode 188: Kona Trip Report with Peter Bindels

Episode 188 of CppCast the first podcast for C++ developers by C++ developers. In this episode Rob and Jason are joined by Peter Bindels to talk about features approved at the ISO C++ Kona meeting for C++20 including Modules, Coroutines and much more.

CppCast Episode 188: Kona Trip Report with Peter Bindels

by Rob Irving and Jason Turner

About the interviewee:

Peter Bindels is a C++ software engineer who prides himself on writing code that is easy to use, easy to work with and well-readable to anybody familiar with the language. Since the last time he's been on CppCast he presented at multiple conferences about build tooling and simple code. In combining both, he created the build tool Evoke from cpp-dependencies and other smaller projects, leading to a simple to use build system presented at CppCon 2018. Earlier this year he presented its companion 2D Graphics library for absolute called Pixel at CppOnSea. He's active in both standards development as well as helping out with various things at conferences.

C++ User Group Meetings in March

The monthly overview on upcoming C++ User Group meetings by Meeting C++

C++ USer Group Meetings in March 2019

by Jens Weller

From the article

The monthly overview of upcoming C++ User Group meetings! Lots of groups already announced their meetings, if your group is not in the list, they might announce later.

Want to speak at a User Group? Use the contact form to reach out to several User Groups that you'd be able to visit for a talk!

There are 4 new C++ User Groups...