Shooting yourself in the foot in various programming environments

This is inspired by, but not directly ripped off from, the original classic computer science joke of shooting yourself in the foot in various programming languages.

Feel free to send me comments, suggestions, or criticism (see my profile for contact methods, or use Webmention).


You load the gun and take aim at your foot, but when you pull the trigger, you discover that one of the grains of gunpowder is a NULL pointer.

Segmentation fault (core dumped)


You shoot yourself in the foot, but forget to delete the bullet and leak memory.

You try to fix the memory leak using smart pointers, but a wave of <> brackets explodes from the gun and crushes your entire leg.


You build your own gun and make your own bullets. When you pull the trigger, the gun fires forwards and backwards, jams, and falls apart.

Segmentation fault (core dumped)

Machine code

You hand-forge all the parts for a gun and bullet casings, mix your own gunpowder, and assemble it. When you pull the trigger, the world freezes.


You shoot yourself in both feet at once using both hands, but if asked to shoot someone else in the foot, you would rather shoot yourself in the face.


The compiler takes the gun away from you and hits you over the head with it when you try to take the safety off. You invert the control structure of your program to satisfy it, and thereby avoid shooting yourself in the foot. This takes two weeks.

Rust (unsafe)

You shoot yourself in the foot. Everyone asks why you did that.


You use a BulletFactory to produce ammunition for one of several Guns, wrap the whole thing in a ShootingManager, and fire at your foot, but the JVM hasn’t warmed up yet. Two minutes later, your foot throws a PainException.


You have a System.Armaments.Firearms.Gun, but can’t find any bullets anywhere. The documentation says they’re in the Firearms namespace with the gun, but doesn’t describe them.


Get-Help Invoke-Pistol provides your first hint about what bullets look like; it says it outputs a System.Armaments.Firearms.SmallCaliberAntiPersonnelBullet it says is fired. You still can't find documentation for bullets. You give up on understanding and pipe it directly to your foot, which throws an InvalidOperationException that propagates backwards through the pipeline and blows up your gun.


You shoot yourself in the foot with ease, but it takes long enough for you to get lunch and still come back in time to put your foot in front of the bullet.


Looking closely at the gun, it turns out to be a table. You type a dot instead of a colon and the foot attempts to shoot a nil at your bullet. The host program neglected a pcall, and the resulting error corrupts its plugin menu.


You dampen your foot and wait for it to rot.


You explain to a classroom of children how to shoot themselves in the foot. They decide to shoot you in the foot instead.


There are eight frameworks for foot-shooting. Of these, three are unmaintained, two are brand-new and full of bugs, one lacks bullets, and the other two require jQuery.

Internet Explorer

The Justice Department arrests you for shooting yourself in the foot.


The Justice Department strongly considers arresting you for shooting yourself in the foot.


Congress orders the Justice Department to arrest you for shooting yourself in the foot.


You take aim and pull the trigger, but the gun crashes because the bullets are of the wrong brand. Upon replacing the bullets and gun and trying again, a new foot, now with hole, appears from the gun. You do not know how to replace your existing foot with the shot one.


You fire and miss because your foot is where your knee should be.


You write a 15-page document describing how to shoot yourself in the foot.


You write a beautiful 5-page document describing how to shoot yourself in the foot. As a bonus, it does it for you when you compile it.


You miss, but you can roll it back and try again as many times as you like.


You use SQL to shoot yourself in the foot and send back an HTML file describing the results. Someone does some SQL injection and drops your bullets.


You validate that your foot is well-formed, then write a stylesheet that makes it look like it has a hole in it.


You specify that your foot is a body part and use an HTTP connection to send it to a server for processing. The result is so deeply buried in metadata that you can’t find the hole.


After shooting your foot, you mark up the hole and publish it. Bots misinterpret the vocabulary and offer you treatments for a stab wound.


You send out a Shooting activity to notify the world that you have shot your foot. Each server interprets this in a subtly different way, and no one can agree where the hole is. A campaign is started to defederate from you.


You set up a descriptor table entry explaining to the processor the foot you would like shot. You must specify the X position of the foot, the privilege level of the shooter (always 0), the Z position of the foot, whether the shooting actually results in a hole, the Y position of the foot, and its volume in cubic centimeters divided by three, in that order. After loading the table, your foot develops a misshapen hole, but 2.6 seconds later System Management Mode overwrites it with a Windows driver and a general protection fault shuts down the machine.


You load a Unicode gun with ANSI bullets and when you pull the trigger your foot is transformed into Asian gibberish.


You don’t have permission to access the foot or the gun.


You ask to be shot in the foot and are presented with 6.4 million choices for guns and bullets. By the time you finally make your decision, the request has timed out.


Two competing proposals for how to shoot feet distract you while a pickpocket empties your wallet. The government promises to regulate this.


After surveying Foot-Shooting-as-a-Service vendors, you conclude none of them meet your requirements. You decide to build your own. Amazon and Microsoft each bill you $1,000,000 every time you touch the gun or look at your foot.


You shoot everyone in the foot and are forced to restore the entire cluster from backups.