From Alessandro Torri’s preface to the first volume of L’Ottimo Commento as edited by himself and others of the Accademia della Crusca (1827):
In C++, there’s often multiple ways to refer to the same entity: aliases, inherited names, injected names, names that differ in qualification… Usually, if an entity has multiple names, which one you use won’t matter: you can use any of those synonymous names and the compiler won’t care.
But each entity always has a uniquely “truest” name, privileged above all the other ways to refer to it. In some situations, in order to do a thing with an entity, you do actually need to call it by its “true name.” Here is a (non-exhaustive) list of such situations.
My grandmother’s grandfather was David Celyddon Phillips (1848–1915), Welsh-born minister and poet, known by the bardic name “Celyddon.” Recently I learned that my second cousin David M. Phillips Jr. has in his possession a leatherbound, hand-written copy of D. C. Phillips’ long narrative poem The Promised One, or, Jesus of Nazareth — previously unpublished as far as either of us know, despite that one of Celyddon’s lengthy obituaries mentions:
Via Hacker News: “Making Explainable Minesweeper” (July 2025). By “explainable Minesweeper,” the blogger means that we generate a Minesweeper level that is guaranteed solvable by perfect play — that is, for which the solution never requires “guessing” at an unknown cell (and possibly losing the game at that point). The blogger describes a procedure for creating partially explainable levels: simply generate a random level, then simulate solving it with a computer player that knows only certain heuristics. If the computer player completes the level without guessing, then it’s good; otherwise, generate a new random level and repeat.
About 15 years ago I was active with the Santa Barbara Jugglers Association (which still exists and still meets up by UCSB in Isla Vista). They’re particularly known for club-passing in moving patterns. We’re talking things like Havana and Shooting Star. (I don’t think either of those patterns came out of Isla Vista, mind you. I don’t know where either of them did come from. The Madison Area Jugglers’ Pattern Book credits Shooting Star to “Bryan Olson in 1993.”)
4x4x4 Tic-Tac-Toe is played on a 4x4x4 cube, containing 64 cells. The first player to get 4 of their own symbols in a row (in any orthogonal or diagonal direction, including the cube’s space diagonals) wins.
The other day I ran across some code like this:
template<class T>
struct Holder {
T t_;
explicit Holder() : t_() {}
Holder(const Holder& rhs) : t_(rhs.t_) {}
~~~~
};
This was in an old codebase, which until recently had still been using
GCC’s -Weffc++
to enforce C++98 idioms such as the explicitly non-defaulted
copy constructor depicted above.
If you’re still using
-Weffc++
, please, stop using it!
Suppose you’re implementing a “Wordle-like” game such as Juho Snellman’s Huewords or Alan Bellows’ Omiword. The defining principle of such games (as I’m defining them here, anyway!) is that the solution to the puzzle is an arrangement of English words which satisfies some criterion, and the player arrives at that solution by guessing various English words, such that the game must differentiate “that’s a valid word, but not the answer” from “that sequence of letters isn’t even a word.”
In Book 4 of Virgil’s Aeneid, I find two noteworthy phrases. First, in Virgil’s description of the monstrous goddess Rumor (lines 173–183; tr. Goold) —
Here’s a simple non-constexpr-friendly Optional
type. (Godbolt.)
template<class T>
class [[trivially_relocatable(std::is_trivially_relocatable_v<T>)]] Optional {
~~~~
alignas(T) char data_[sizeof(T)];
bool engaged_ = false;
};
Here’s a simple C++20 constexpr-friendly Optional
type. (Godbolt.)
template<class T>
class [[trivially_relocatable(std::is_trivially_relocatable_v<T>)]] Optional {
~~~~
union {
char pad_;
T t_;
};
bool engaged_ = false;
};
Here’s a simple and trivially relocatable MoveOnlyCallable
type. This is like
std::move_only_function<int(int) const>
,
except that the “take int
and return int
” part is hard-coded, for simplicity.
(Godbolt.)
Martin Gardner’s “Mathematical Games” column of April 1979, on the subject of Harary tic-tac-toe, gives Frank Harary’s own pet names for the five free tetrominoes, or “order-4 animals,” as Harary called them. This reminded me of the meme assigning (fake) names to the Tetris pieces.
On StackExchange, someone asks why programmers talk about “calling” a function. Several possible allusions spring to mind:
- Calling a function is like calling on a friend — we go, we stay a while, we come back.
- Calling a function is like calling for a servant — a summoning to perform a task.
- Calling a function is like making a phone call — we ask a question and get an answer from outside ourselves.
The true answer seems to be the middle one — “calling” as in “calling up, summoning” — but indirectly, originating in the notion of “calling for” a subroutine out of a library of subroutines in the same way that we’d “call for” a book out of a closed-stack library of books.
Way back in 2022, I got the idea to do the Martin Gardner thing — to collect a few of the best posts I’d written for this blog and publish them as a proper paper book. I chickened out at the time, but this month I decided the stars were right to revisit that old project and finally publish my first collection of Essays on Modern C++.
I’m just now getting around to blogging this snippet from March 2024 (hat tip to Chip Hogg). Apparently some units libraries — things like Au and mp-units — find it useful to represent linear combinations of units as the products of primes; for example, if you represent “meters” as 2 and “seconds” as 5, then “meter-seconds” is 10. Or at least that’s the general idea, I think. Don’t quote me on that part.
This means there’s a market for fast compile-time versions of the functions next_prime_after(p)
and prime_factors_of(c)
. Chip even went so far as to propose that vendors should provide
“largest prime factor of c
” as a builtin; see P3133 “Fast first-factor finding function”
(February 2024). I said, “You don’t need the vendor to do your factoring; you can write that in
general-purpose C++ already!”
Today I learned that the New York Public Library has a blog, on which, many years ago, curator Douglas Reside had a “Musical of the Month” series where he posted old libretti, recordings, and other paraphernalia. Sadly the NYPL’s current website design lacks any coherent indexing or tagging system: no full-text search, no search by author, etc. So, for my own benefit and the benefit of posterity, here are direct links to all of the NYPL “Musical of the Month” blog posts — at least, all of them I could discover via public indices. If you discover any more, please tell me and I’ll add them here!
Charles Haddon Spurgeon, whom we met in yesterday’s post, tells the following “Spartan saying” (Plutarch 234D) better than Plutarch does:
From John Cooper Mendenhall’s “Aureate Terms” (1919):
Who dare call the clerks blind who saw only the golden side of the shield?
This is a reference to a fable originating with Joseph Spence (writing as “Sir Harry Beaumont”) in Beaumont’s Moralities (1753).
All C-style programming languages have too many levels of operator precedence. This confuses their programmers, who have to remember not just the basic PEMDAS stuff but the really arcane precedences, too: