Funniest line of code ever ?

Started by
125 comments, last by Orymus3 9 years, 2 months ago

And talking about TIGSource again, this whole thread. It started as somebody asking how to check if a number was a multiple of 5, and it somehow devolved into people figuring out the most contrived way to solve that problem (...yes, myself included). There's some serious TDWTF-worthy material there.

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.
Advertisement

This snippet comes courtesy of some healthcare related development I'm involved in:

if (staff.StaffType != null && !staff.Staff.StaffTypes.Any(st => st.StaffType.Id == staff.StaffType.Id))

staff.Staff.StaffTypes.Add(new StaffStaffType(staff.Staff, staff.StaffType));

StaffBO.Save(staff.Staff);

Reminded me of the "Spam Spam Spam..." Monty Python skit.

[size="2"]Currently working on an open world survival RPG - For info check out my Development blog:[size="2"] ByteWrangler

I don't get it. Can someone please elaborate?

What will you make?


Think of how lonely you are if you're making programming jokes.

And think about how lonely you must be to troll forums with programming jokes. Just think about it.

I think, therefore I am. I think? - "George Carlin"
My Website: Indie Game Programming

My Twitter: https://twitter.com/indieprogram

My Book: http://amzn.com/1305076532

Found this on TIGSource, and yes, it compiles and works as intended:


switch(mode)
{
    case(0): if(test(a, b))
             {
    case(1):     result = foo(a, b);
                 break;
             }
             else
             {
    case(2):     result = bar(a, b);
                 break;
             }
}

Duff's device seems to use a similar mechanism to "jump" into a location of code.

[EDIT] Whoops, just saw that someone already linked that (indirectly). Oh well.

"I would try to find halo source code by bungie best fps engine ever created, u see why call of duty loses speed due to its detail." -- GettingNifty

Except for the fact that Duff's device doesn't break through scope boundaries. Fair enough, with goto that's common, but at least there you expect that kind of stuff (especially since when goto is used it's normally to break away into an outer scope) but definitely not in a switch statement.

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

http://hg.icculus.org/icculus/lugaru/file/97b303e79826/Source/GameTick.cpp#l7276

^

This. All of them.

Wow. That's some bad code.

I think, therefore I am. I think? - "George Carlin"
My Website: Indie Game Programming

My Twitter: https://twitter.com/indieprogram

My Book: http://amzn.com/1305076532

My brain definitely just hurt itself trying to read through all of that. it's completely indecipherable, like the lost language of an unknown civilization.

Comments really would have helped, but that...thing...is still very poorly designed!

My website! yodamanjer.com
My development blog!

Follow me on Twitter! [twitter]jwg1991[/twitter]

This topic is closed to new replies.

Advertisement