6 Replies - 1141 Views - Last Post: 03 May 2011 - 11:25 AM

#1 Hiram  Icon User is offline

  • D.I.C Head

Reputation: 69
  • View blog
  • Posts: 203
  • Joined: 02-June 09

Worst piece of code you've ever seen?

Posted 02 May 2011 - 09:36 PM

We've all seen some pretty sad lines of code, whether or not it was written by a younger, less experienced you from the past, or someone else. What's the worst you've come across?

Personally, some of my "favourites" have been declaring every variable globally, at the top of the file, even your typical "int i" for your for loops, and checking booleans in an odd way, like this:

bool foo = false;

if (foo == true)
{
   // make magic happen
}



Is This A Good Question/Topic? 0
  • +

Replies To: Worst piece of code you've ever seen?

#2 no2pencil  Icon User is online

  • Toubabo Koomi
  • member icon

Reputation: 5246
  • View blog
  • Posts: 27,060
  • Joined: 10-May 07

Re: Worst piece of code you've ever seen?

Posted 02 May 2011 - 10:13 PM

The worst piece of code I have seen recently was a shell script. In it the code set a variable with current working directory (output of pwd), then did an action that didn't use the variable, & then unset the variable.
Was This Post Helpful? 0
  • +
  • -

#3 cfoley  Icon User is offline

  • Cabbage
  • member icon

Reputation: 1949
  • View blog
  • Posts: 4,048
  • Joined: 11-December 07

Re: Worst piece of code you've ever seen?

Posted 03 May 2011 - 04:58 AM

awww these pieces of code aren't that bad. I've got plenty of bad code on my machine right now. Some of them even have logic and/or compile errors!
Was This Post Helpful? 0
  • +
  • -

#4 NeoTifa  Icon User is offline

  • Whorediot
  • member icon





Reputation: 2637
  • View blog
  • Posts: 15,663
  • Joined: 24-September 08

Re: Worst piece of code you've ever seen?

Posted 03 May 2011 - 06:10 AM

Everything that I write. :P

This post has been edited by NeoTifa: 03 May 2011 - 06:10 AM

Was This Post Helpful? 0
  • +
  • -

#5 codeprada  Icon User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 946
  • View blog
  • Posts: 2,355
  • Joined: 15-February 11

Re: Worst piece of code you've ever seen?

Posted 03 May 2011 - 09:03 AM

ScriptKiddie sk = new ScriptKiddie();
sk.initialize_hax(ScriptKiddie::CIA_FIREWALL_BREAKER);
sk.set_options(ScriptKiddie::TIMEOUT, -1); //never give up!!
sk.set_options(ScriptKiddie::MESSAGE_TO_DELIVER, "If you're reading this then someone's gonna get fired");
sk.run();


Was This Post Helpful? 0
  • +
  • -

#6 Creecher  Icon User is offline

  • I don't care
  • member icon

Reputation: 561
  • View blog
  • Posts: 2,049
  • Joined: 06-March 10

Re: Worst piece of code you've ever seen?

Posted 03 May 2011 - 09:21 AM

 ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.-/>-------.>+.>.



Hello, world! in Brainfuck.
Was This Post Helpful? 0
  • +
  • -

#7 no2pencil  Icon User is online

  • Toubabo Koomi
  • member icon

Reputation: 5246
  • View blog
  • Posts: 27,060
  • Joined: 10-May 07

Re: Worst piece of code you've ever seen?

Posted 03 May 2011 - 11:25 AM

View PostNeoTifa, on 03 May 2011 - 09:10 AM, said:

Everything that I write. :P

Everything that she writes.
Was This Post Helpful? 2
  • +
  • -

Page 1 of 1