5

Example:

This is absolutely wrong. To what does a point? You don't know the answer to that question and neither do I. This is a prime example of overwriting memory. When char *a is declared, it points to a random location in memory. In computer jargon, we can say that a points to garbage as soon as it is declared. However, one programmer's garbage may be anther's treasure. As was stated in prior chapters, when you overwrite computer memory, you're involved in a game of logic Russian roulette, and the outcome can be almost anything. The program may work or seem to work perfectly. If this is true, then the hammer fell on an empty chamber. The computer could have locked up, or worse, returned inaccurate information. Bingo! The hammer fell on a loaded chamber. While such occurrences are rarely disastrous when using small-memory model compilers, large-memory model versions may allow a memory overwrite to trip a few interrupts and, maybe, erase the file allocation table (FAT) on your hard drive. Double bingo! You've just rendered your entire hard disk useless!

Is that an idiom? What exactly does it mean? What kind of chamber are they talking about?

2
  • 1
    To repeat and expand on @VictorBazarov's comment: this is not an idiom. If you use the phrase "the hammer fell on an empty chamber" without context, I think some readers will be confused about what you mean, and even readers who guess what you mean will think the phrase sounds out of place. The phrase works here because of the earlier phrase "you're involved in a game of logic Russian roulette," which introduces the Russian roulette metaphor.
    – Vectornaut
    Commented Aug 22, 2015 at 20:37
  • It doesn't help that the author mixes in another metaphor that would only be familiar to American English speakers--the term "Bingo!" Commented Sep 8, 2015 at 17:03

2 Answers 2

16

It is using gun terminology as a metaphor for luck. In a gun, the slots where the bullets go are called "chambers" and the thing that hits the bullet to make it fire is called a "hammer".

The game Russian Roulette is a game of chance that uses a revolver with only one bullet loaded which is then spun randomly and fired. If the person is lucky, there will not be a bullet in the chamber it landed on (it will be empty), if they are unlucky there will be a bullet there (it will be loaded).

When you fire a gun, pulling the trigger causes the hammer to "fall" against the bullet in the chamber, which fires it. So saying "the hammer fell on an empty chamber" means you got lucky; saying "the hammer fell on a loaded chamber" means you got unlucky.

2
  • 3
    The earlier phrase "you're involved in a game of logic Russian roulette" plays the crucial role of introducing the metaphor. Without that introduction, the later reference to hammers and chambers would sound very strange, although a reader familiar with Russian roulette as a metaphor might understand what the writer was trying to say.
    – Vectornaut
    Commented Aug 22, 2015 at 20:27
  • 1
    I would add not just as "a metaphor for luck" but "a metaphor for luck despite doing something foolhardy." The author's point is that writing to arbitrary memory locations in C code is not just likely to cause unexpected behavior (up to and including crashing the computer and losing data) but that such behavior is a direct result of careless programming. Likewise, playing Russian Roulette is a pretty foolhardy thing to do with a revolver. Commented Sep 8, 2015 at 17:06
10

In this case, the hammer and chamber refer to parts of a gun:

The hammer of a firearm is a part that swings to impart a blow (impact) that will initiate a firing when the trigger is pulled.

In firearms, the chamber is the portion of the barrel or firing cylinder in which the cartridge is inserted prior to being fired.

An empty chamber contains no bullet, and this is a fortunate outcome in a game of Russian roulette (if it's your turn). In your case, 'The program may work or seem to work perfectly.' is also a fortunate outcome.

For the loaded chamber, it is just the reverse.

1
  • 5
    It's not an idiom. There is a reference to Russian roulette, which is "played" with a revolver with one chamber charged and the rest empty. The player spins the cylinder, then cocks the gun, puts the muzzle to his temple and pulls the trigger. The hammer then falls and either strikes the round (and the gun fires) or it falls on an empty chamber. Commented Aug 21, 2015 at 18:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .