Succession joke chyrons

My wife and I just last month finished bingeing Succession (HBO, 2018–2023). One of the fun things about Succession is its little throwaway gags in the form of news chyrons on ATN, the Roy family’s Fox-alike news channel. Here’s all the joke chyrons I’ve noticed. If I missed one, please alert me and I’ll add it!

Read More

The style guide must say how to do what you mustn’t do

Consider the following snippets of C++ code. Which ones do you think a good compiler would warn about?

[[nodiscard]] int f();

f();
(void)f();
(int)f();
int dummy = f();
[[maybe_unused]] int dummy = f();
int _ = f();

I recently heard someone complaining that the last two lines didn’t warn. “Aren’t those declarations basically saying that we plan to sometimes let that value go unused? But the author of f said not to ignore its return value!”

The thing is: We must distinguish between the roles of a compiler warning, which says “Hey, your syntax probably doesn’t match your intent!”; and of a style guide, which says “Hey, your intent doesn’t match your boss’s intent!”

Read More

Space-filling polycube snakes

In “Polycube snakes and ouroboroi” (2022-11-18), I quoted Martin Gardner (June 1981) on the topic of filling space with polycube snakes:

We now ask a deceptively simple question. What is the smallest number of snakes needed to fill all space? We can put it another way: Imagine space to be completely packed with an infinite number of unit cubes. What is the smallest number of snakes into which it can be dissected by cutting along the planes that define the cubes?

[… Scott] Kim has found a way of twisting four infinitely long one-ended snakes into a structure of interlocked helical shapes that fill all space. The method is too complicated to explain in a limited space; you will have to take my word that it can be done. […] Kim has conjectured that in a space of \(n\) dimensions the minimum number of snakes that completely fill it is \(2(n-1)\), but the guess is still a shaky one.

Back in March, I contacted Scott Kim through the Gathering 4 Gardner meetup and asked if he recalled his solution. Of course he did!

Read More

PSA: Value-initialization is not merely default-construction

At the Varna WG21 meeting, Giuseppe D’Angelo presented his P2782 “Type trait to detect if value initialization can be achieved by zero-filling”. The intent of this new type trait is to tell vector’s implementor whether

std::vector<T> v;
v.resize(1000);

can just do a memset of all the T objects to put them into their correctly constructed state. By “correctly constructed state,” I mean the state a T would be in after

::new (p) T(); // value-initialization
Read More

Themistocles and Alexander

Plato’s Republic (330a) alludes to the story of Themistocles and the Seriphian, also found in Plutarch’s Lives. (Themistocles was the preeminent Athenian of his day, known for his accomplishments as a general and as a statesman. Serifos, a small island in the Aegean, was the Podunk of ancient Greece. Its main claim to fame was its mute frogs.) Anyway, one time Themistocles met a Seriphian “big fish” at a cocktail party or something, and their exchange went something like this:

Read More

P1144 PMR koans

This is the fourth in a series of blog posts (I, II, III, IV) that I started after the Issaquah WG21 meeting, in order to (1) resolve the technical differences between P1144 “std::is_trivially_relocatable and the now-multiple Bloomberg papers on the topic (P2786R1, P2839R0, and the comparative analysis P2814R0), and (2) convince the rest of the C++ Committee that these resolutions are actually okay to ship.

Read More

Don’t forward things that aren’t forwarding references

Some readers of yesterday’s post may wonder about the part where I wrote:

  explicit Foo(Ts... as, Ts... bs)
    : a_(static_cast<Ts&&>(as)...),
      b_(static_cast<Ts&&>(bs)...) {}

Since we all know that std::forward<T>(t) is synonymous with static_cast<T&&>(t), why did I choose static_cast above instead of writing std::forward<Ts>(as)...?

Read More