Articles

You know what I don't like? Emperors clad in boxers.

December 2021 · Embracing Modern C++ Safely

Foreword to Embracing Modern C++ Safely

Do you like version control systems — Git, Perforce, Mercurial, and such? I love them!

The foreword, signed May 2021, is in Pearson's free sample of Embracing Modern C++ Safely, from page xv.

December 2021 · Embracing Modern C++ Safely

Variadic Templates

Section 2.1 of Embracing Modern C++ Safely, John Lakos, Vittorio Romeo, Rostislav Khlebnikov, and Alisdair Meredith, Addison-Wesley, 2021.

May 2010 · Self-published

Tips on Giving Technical Talks

The dice are already rigged in your favor.

February 2006 · C/C++ Users Journal

Maps with Expensive Keys

The real world is not jerky. Columnists sometimes are.

December 2005 · C/C++ Users Journal · with Emery Berger

Policy-Based Memory Allocation

I sat down and wrote down an implementation that has portability as its only merit; other than that, it's not particularly performant, interesting, or original.

October 2005 · C/C++ Users Journal · with Bartosz Milewski

Walking Down Memory Lane

What looks like a duck, quacks like a duck, and chops your leg off in one bite? A polyglot alligator in disguise, of course.

August 2005 · C/C++ Users Journal

Type-Safe Formatting

Printf is about as well-intended, fast, and prone to disaster as a playful Great Dane running in a porcelain boutique.

June 2005 · C/C++ Users Journal

Prying Eyes: A Policy-Based Observer (II)

Metaphors are great, but only when they resist beyond the watercooler conversation level.

April 2005 · C/C++ Users Journal

Prying Eyes: A Policy-Based Observer (I)

So program correctness is left to two of the least reliable teammates: attention and discipline.

December 2004 · C/C++ Users Journal · with Maged Michael

Lock-Free Data Structures with Hazard Pointers

Do you have my $19,990 yet? No? Oh, no problem. Here is my last $10. I'll drop by some other time to see if you got my $20,000.

October 2004 · C/C++ Users Journal

Lock-Free Data Structures

It's like an electric fence that has the turn-off button up on top of it: to safely climb the fence you need to disable it first, but to disable it you need to climb it.

August 2004 · Dr. Dobb's Journal · with Scott Meyers

C++ and the Perils of Double-Checked Locking

Multithreading is just one damn thing after, before, or simultaneous with another.

July and August 2004. The updated PDF is the one to read.

June 2004 · C/C++ Users Journal

yasli::vector Is On The Move

The largest problem with std::vector is that it conflates two different concepts: data moving and data copying. Here. I said it.

April 2004 · C/C++ Users Journal · with David B. Held

Smart Pointers Reloaded (IV): Finale

May you be referenced for a long, long time.

February 2004 · C/C++ Users Journal · with David B. Held

Smart Pointers Reloaded (III)

If you were thinking you really can do what you want in C++, it's about time to disabuse yourself of that illusion.

December 2003 · C/C++ Users Journal · with David B. Held

Smart Pointers Reloaded (II): Exception Safety Analysis

There could also be "the wacky guarantee," which means that the system is in an undefined state in which you have no idea what might happen next, so you better call abort ASAP.

October 2003 · C/C++ Users Journal · with David B. Held

Smart Pointers Reloaded

When it comes to smart pointers, there's only one person who knows the one true right way to implement them—and that person is you.

August 2003 · C/C++ Users Journal · with John Torjo

Enhancing Assertions

Homemade muesli, my personal recipe: 50% oats, 50% nuts, 50% raisins — try to beat that!

June 2003 · C/C++ Users Journal · with Petru Marginean

Enforcements

And crossing fingers is not really a good programming technique.

April 2003 · C/C++ Users Journal

Assertions

They are a modus vivendi, a deep conviction that divides programmers in two cliques: those who understand, and those who don't understand, the power of... but I'm getting ahead of myself.

February 2003 · C/C++ Users Journal

Move Constructors

Remember when I said: "the copy constructor is a function like any other?" Well, I lied.

December 2002 · C/C++ Users Journal

Efficient Generic Sorting and Searching in C++ (II)

Given that it takes about a decade for a successful concept in Computer Science to make a career in the industry, I predict it's about time that the industry gives in and gets randomized.

October 2002 · C/C++ Users Journal

Efficient Generic Sorting and Searching in C++ (I)

In correlation with the "Not Invented Here" syndrome, yours truly must be suffering from the "Invented Here" syndrome.

August 2002 · C/C++ Users Journal

Discriminated Unions (III)

You're on your own, and the compiler is like the Mob — it's always better to have it on your side.

June 2002 · C/C++ Users Journal

Discriminated Unions (II)

Erring on the large side of alignment is not that bad in most cases. (Erring on the small side is disastrous.)

April 2002 · C/C++ Users Journal

Discriminated Unions (I)

Believe me: in spite of the appearances, if you were looking for an article on programming, you're in the right place.

March 2002 · InformIT

Multithreading and the C++ Type System

Unfortunately, "simple" might sometimes morph into "simplistic."

February 2002 · C/C++ Users Journal

Typelists and Applications

If you can't tell a typelist from a Christmas wish list, you're in the right place.

December 2001 · C/C++ Users Journal

Typed Buffers (III)

Like those Freudian reports that link the mid-life angst to some little event in childhood, memory allocation in C++ has quite an interesting story that harkens back to C.

October 2001 · C/C++ Users Journal

Typed Buffers (II)

Were it an original idea, I would have hastened to call filling by copy "The Romanian Peasant" algorithm.

August 2001 · C/C++ Users Journal

Typed Buffers (I)

As it often happens with C++, the scenery you enjoy at the top of the hill is well worth the effort — if only you could ignore that thing you just stepped in.

June 2001 · C/C++ Users Journal

A Policy-Based basic_string Implementation

Copy-on-write is fondly called COW by its fans, and "the mad cow" by its opponents.

April 2001 · C/C++ Users Journal

Min and Max Redivivus

Java and C#, two newer and supposedly superior languages, are utterly impotent at expressing min and max because, you know, min and max are not objects.

February 2001 · C/C++ Users Journal

volatile — Multithreaded Programmer's Best Friend

I prefer deadlocks to race conditions because they are so much easier to debug.

December 2000 · C/C++ Users Journal · with Petru Marginean

Simplify Your Exception-Safe Code — Forever

If you designed C++, would you have called the destructor for an object whose very construction failed?

The ScopeGuard technique. Later work turned the same idea into D's scope statement.

October 2000 · C/C++ Users Journal

Mappings between Types and Values

If Clint Eastwood asked me "Do you feel lucky?", I'd certainly say I do.

June 2000 · XP2000, Cagliari

The Design Is In The Code

A design is a deliberate choice of a set of tradeoffs, out of a combinatorial space.

Also chapter 30, The Design Is in the Code: Enhanced Reuse Techniques in C++, in Extreme Programming Examined, Giancarlo Succi and Michele Marchesi, eds., Addison-Wesley, 2001.

June 2000 · C++ Report

Traits on Steroids

Static lock, bad juju!

April 2000 · C++ Report

Traits: The else-if-then of Types

This looks like an if statement, only it's driven by types.

March 2000 · C++ Report · with John Vlissides

To Code or Not to Code (I)

The more code you don't write, the easier your life gets, and the fewer bugs you'll get blamed for.

May 2000 · C++ Report · with John Vlissides

To Code or Not to Code (II)

If you're prepared to believe that SINGLETON is worth implementing in a reusable fashion (and shame on you if you're not), then you've got a problem.

April 1999 · C/C++ Users Journal

Adapting Automation Vectors to the Standard Vector Interface

Sometimes you can even lie about what's inside a container, and to good advantage.

March 1999 · C/C++ Users Journal

Better Template Error Messages

We take for granted that debugging templates is a nightmare, but maybe that doesn't have to be true forever.

October 1998 · C/C++ Users Journal

Compound Iterators for STL

Iterators can hide a multitude of sins.

September 1998 · C/C++ Users Journal

Inline Containers for Variable Arguments

How can you pass a varying number of arguments to a function and maintain type safety? One argument at a time.