A customization point is a code construct that the user can leverage to specialize how a particular library action is handled. A common way of implementing this in C++ is to define a template with the default behavior, and let users specialize it for their own types —e.g.,
std::hash—. This is the story of Spirit X3 and how it lets you specialize customization points without ever leaving your own namespace, sort of...
The Zen of Python tell us that Explicit is better than Implicit. This is good advice for any and all languages, but what are the implications in the C++ lands? There is one particular C++ feature that relates directly to that advice; one important enough that grants on its own the introduction of a keyword. That feature is user-defined conversions and that keyword is
C++'s basic source character set consists of only 96 characters, while also offering a way to name any character in the ISO10646 universal character set —the character repertoire of Unicode—. As little as this may sound, nine of those characters lay outside the ISO646 invariant character set. This can be problematic when the encoding and/or keyboard used to write code does not support one or more of these nine characters. Hence, a workaround is born...
Episode Three tells us about friendship, and how it can be used to narrow access to a class or function. However, that's not the only thing friendship restricts, it also restricts how we may use such class or function. What follows is a concrete example of how friendship may cramp your style.
In C++, a friend of a class is a function or class that is given permission to use the
protected member names from the class. In these lands, a friend is someone who can touch one's private parts...
A naming convention is a set of rules for choosing the character sequence to be used for identifiers which denote variables, types and functions etc. in source code and documentation. They can be a source of enormous controversy, the kind of controversy that start wars —flame wars that is—. C++ specifies a naming convention for reserved identifiers, names that can be safely used by the implementation and standard library, and which result in undefined behavior if used in a program. Such naming convention is standard, so there shouldn't be any controversy, and any standard conformant code has to make sure it does not declare any one of those reserved names.
Const-correctness is the form of program correctness that deals with the proper declaration of objects as mutable or immutable. The idea of constness is a compile-time enforced construct that indicates what a programmer should do, it communicates information about a value's intended use: whether something may or may not be modified. Embedding such intent by means of a keyword will result in clearer, easier to follow code; and if you happen to stray from the declared intent the compiler will step up and make you think twice about what you are trying to do.
There was once a blog about a series of tales, memories gathered during a never-ending journey of C++ development, a recollection of advice helpful to those navigating these wild lands. The whispers went quieter, and for a while no more tales where heard... It’s once again an exciting time for C++, and with that the whispers awakened and got louder one more time. And so, I decided it was the right time to reboot that blog; time to record new tales but also to review the ones already told.