Jump to content
IGNORED

Shooting yourself in the foot in different programming languages


acadiel

Recommended Posts

Assembly

  • You try to shoot yourself in the foot only to discover that you must first invent the gun, the bullet, the trigger, and your foot.
  • You crash the OS and overwrite the root disk. The system administrator arrives and shoots you in the foot. After a moment of contemplation, the system administrator shoots himself in the foot and then hops around the room rapidly shooting at everyone in sight.
  • By the time you've written the gun, you are dead, and don't have to worry about shooting your feet. Alternatively, you shoot and miss, but don't notice.
  • Using only 7 bytes of code, you blow off your entire leg in only 2 CPU clock ticks.

BASIC

  • Shoot self in foot with water pistol. On big systems, continue until entire lower body is waterlogged.
  • If using TI-BASIC variant, watch bullet slowly exit gun and travel through the air and then slowly pierce foot

Forth

  • Foot in yourself shoot.
  • First you decide to leave the number of toes lost on the stack and then implement the word foot-toes@which takes three numbers from the stack: foot number, range, and projectile mass (in slugs) and changes the current vocabulary to blue. While testing this word you are arrested by the police for mooning (remember, this is a bottom-up language) who demonstrate the far better top-down approach to damaging yourself.
  • BULLET DUP3 * GUN LOAD FOOT AIM TRIGGER PULL BANG EMIT DEAD IF DROP ROT THEN. This takes about five bytes of memory, executes in two to ten clock cycles on any processor, and can be used to replace any existing function of the language as well as in any future words. Welcome to bottom-up programming, where you too can perform compiler pre-processing instead of actually writing code.

Logo

  • You can easily shoot the gun, but you have to work out the geometry to make sure the bullet goes into your foot.

(source: http://www.toodarkpark.org/computers/humor/shoot-self-in-foot.htmlexcept TI BASIC which was me)

  • Like 11
Link to comment
Share on other sites

We shouldn't leave out both guys who use Pascal. :)

 

Pascal

  • The compiler won't let you shoot yourself in the foot.
  • The gun is mounted such that it cannot point towards your feet, but you can swivel it round and shoot yourself in the head instead.
  • Like 1
Link to comment
Share on other sites

This is my favorite: (note the blank behind the asterisk in the rm line)

 

 

$ ls
foot.c foot.h foot.o toe.c toe.o
$ rm * .o
rm: .o: No such file or directory
$ ls
$

 

 

because I did something similar some weeks ago, trying to copy files from my backup drive to my home directory:

 

 

$ rsync -avuK /mnt/backup/home/michael/ ~
$ rm -rf /mnt/backup/home/michael/ ~

 

(first line copies files to my user directory, ~ = /home/michael, second line shall remove the directory (unconditionally, recursively), but I copied the line and forgot to remove the ~, so it wiped both)

Link to comment
Share on other sites

:D

 

There are so many versions of this. Here's another list, which seems to combine many versions, and trace their history: http://www-users.cs.york.ac.uk/~susan/joke/foot.htm

 

Still incomplete, however.

 

Favorite bits from this list:

 

 

dBase (alternative) You buy a gun. Bullets are only available from another company and are promised to work so you buy them. Then you find out that the next version of the gun is the one scheduled to actually shoot bullets.
Java You locate the Gun class, but discover that the Bullet class is abstract, so you extend it and write the missing part of the implementation. Then you implement the ShootAble interface for your foot, and recompile the Foot class. The interface lets the bullet call the doDamage method on the Foot , so the Foot can damage itself in the most effective way. Now you run the program, and call the doShoot method on the instance of the Gun class. First the Gun creates an instance of Bullet , which calls the doFire method on the Gun . The Gun calls the hit(Bullet) method on the Foot , and the instance of Bullet is passed to the Foot . But this causes an IllegalHitByBullet exception to be thrown, and you die.
Assembly Language (alternatives) You try to shoot yourself in the foot only to discover you must first reinvent the gun, the bullet, and your foot.
COBOL USEing a COLT 45 HANDGUN, AIM gun at LEG.FOOT, THEN place ARM.HAND.FINGER on HANDGUN.TRIGGER, and SQUEEZE. THEN return HANDGUN to HOLSTER. CHECK whether shoelace needs to be retied.
Smalltalk You spend so much time playing with the graphics and windowing system that your boss shoots you in the foot, takes away your workstation, and makes you develop in COBOL on a character terminal.
Edited by pacman000
  • Like 2
Link to comment
Share on other sites

Assembly

  • You try to shoot yourself in the foot only to discover that you must first invent the gun, the bullet, the trigger, and your foot.
  • Using only 7 bytes of code, you blow off your entire leg in only 2 CPU clock ticks.

 

 

GPL

  • You can maybe find the bullet in the system GROMs, but it's undocumented.
  • It uses 3 bytes of code, but it takes 50 CPU clock ticks.
  • Like 4
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...