Advertisement

Funniest line of code ever ?

Started by July 17, 2014 08:27 AM
125 comments, last by Orymus3 9 years, 8 months ago

And Python is notorious for storing everything as a type/pointer pair internally (which can be quite of an issue for cache usage). Well, from what I've read at least. I have absolutely no idea how other languages handle this (but I imagine other duck typed languages don't have it much better either).


About the bitfields: it just can't work with the language semantics defined in C as it would violate either that the array elements are contiguous or that they have individual adresses.

The thing is that it would be nice if there was a way to do both simultaneously =O) (even if that means that internally they're completely different, or even to the point different symbols are needed to make the difference clear)

Then again it's probably just me being mean, unless you have many thousands (if not millions) of variables you probably don't miss much on using bytes instead of bits, and if you are in such a case, it's probably something high performance enough (speed- and/or memory-wise) to warrant the sightly uglier code.

EDIT: oh, also found this gem in my code


   // Set position of candidate list if needed
   // Inside its own scope to limit the existence of temporary variables
   {
   }

Pretty sure I've already done this... but the code ended up elsewhere. Whoops. (that code I quoted was a placeholder so I could get an idea later of where it was supposed to go once I figured out how to use the API function, and I completely forgot about it I guess - oh, as a bonus, it turned out that function was buggy and I had to report it and wait for an update before being able to use it anyway =P)

EDIT 2: found where I ended up doing it, immediately above that /o\ (so yes, literally at the same point in the program) Now I feel even more stupid.

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.

Wrote this in a C# winforms application:


foreach (TabPage tp in tcAllTabs.TabPages) // for my bunghole!
{
   ...

}
Advertisement

I saw this about a year ago in a graphics engine, and I've kept a screenshot to remind me of it:


float PI = 57.29578f; // (7/22)*180

I love this on two levels. First, this number isn't the universal constant pi. That should be enough, but... the number isn't the result of the calculation in the comment, either.

7/22 is approximately pi. The number be assigned here is actually pi/180, and it was used in the code to convert radians to degrees.

Ben // developing Substream on Greenlight - third-person shmup choreographed to music, custom engine, procedural morphing environments.


Nice reference you got there smile.png

spoiler: http://thedailywtf.com/Articles/What_Is_Truth_0x3f_.aspx

I saw this about a year ago in a graphics engine, and I've kept a screenshot to remind me of it:


float PI = 57.29578f; // (7/22)*180

I love this on two levels. First, this number isn't the universal constant pi. That should be enough, but... the number isn't the result of the calculation in the comment, either.

7/22 is approximately pi. The number be assigned here is actually pi/180, and it was used in the code to convert radians to degrees.

I never include constants in my search for bugs. From now on I'll start there, just in case.

wow

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

Somewhere in a text editor application I saw this line:


const char* CARROT = "^";
"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

I saw this about a year ago in a graphics engine, and I've kept a screenshot to remind me of it:

float PI = 57.29578f; // (7/22)*180
I love this on two levels. First, this number isn't the universal constant pi. That should be enough, but... the number isn't the result of the calculation in the comment, either.

7/22 is approximately pi. The number be assigned here is actually pi/180, and it was used in the code to convert radians to degrees.

Actually pi/180? Hmm
"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley
Advertisement

Actually pi/180? Hmm

Arrrrww!! blink.png 180/pi

The irony. laugh.png

Ben // developing Substream on Greenlight - third-person shmup choreographed to music, custom engine, procedural morphing environments.

Actually pi/180? Hmm

Arrrrww!! blink.png 180/pi

The irony. laugh.png

Closer, but still wrong ;)

Actually pi/180? Hmm

Arrrrww!! blink.png 180/pi

The irony. laugh.png

Closer, but still wrong ;)

It's an engineer's 180/pi tongue.png

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

180 / that constant = pi

Also found this line after a huge commented out block:

   // Why do all the above when PhysicsFS already does it?!

I wonder why I left the commented out code there. Probably for the sake of amusement =P

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.

This topic is closed to new replies.

Advertisement