Page 4 of 4

Re: Funny comments in your OS's Source code?

Posted: Mon Apr 28, 2014 10:31 am
by DavidCooper
That one is good - the first one to make me laugh.

Re: Funny comments in your OS's Source code?

Posted: Mon Apr 28, 2014 9:11 pm
by thepowersgang
Not so much a funny commit, but one that is quite rude to myself for a very dumb bug that I spent a few months debugging or working around. (I've edited this version of the committ slightly, see it in its full glory here)

The bug this caused was the first (or second, can't remember which) thread to wait on a mutex would be lost and hence block indefinitely. This ended up being the shell in VT1, so I had to switch VTs to test any of the userland.

Code: Select all

commit da67fd4fd32d16dcd6b4cb0b63497a9925a2ef35
Author: John Hodge <[email protected]>
Date:   Sat Oct 2 21:56:44 2010 +0800

    Placed a comment to not the location of the blocker

diff --git a/Kernel/threads.c b/Kernel/threads.c
index 3b73111..b9d59f3 100644
--- a/Kernel/threads.c
+++ b/Kernel/threads.c
@@ -1044,6 +1044,9 @@ void Mutex_Release(tMutex *Mutex)
                Mutex->Owner = Mutex->Waiting;  // Set owner
                Mutex->Waiting = Mutex->Waiting->Next;  // Next!
                // Reset ->LastWaiting to NULL if we have just removed the last waiting thread
+               // 2010-10-02 21:50 - Comemerating the death of the longest single
+               //                    blocker in the Acess2 history. REMEMBER TO
+               //                    ____ING MAINTAIN YOUR ____ING LISTS DIPWIT
                if( Mutex->LastWaiting == Mutex->Owner )
                        Mutex->LastWaiting = NULL;

Re: Funny comments in your OS's Source code?

Posted: Tue Apr 29, 2014 2:39 am
by Bender
@thePowersGang:
Should we make an 'Acess' swear count? lol we already have a Linux counterpart.

Re: Funny comments in your OS's Source code?

Posted: Fri May 02, 2014 9:57 am
by onlyonemac
On the topic of bugs in other people's code, I once found a comment left by a programmer who seemed he had to vent his fury one way or another over a complicated I/O routine while browsing the source code of a certain Linux desktop manager:

Code: Select all

 /* damn that bloody numlock stuff - ok I'd rather XFree got fixed to not */
/* have it as a modifier and everyone have to write specific code to mask */
/* it out - but well.... */
/* ok under Xfree Numlock and Scollock are lock modifiers and we need */
/* to hunt them down to mask them out - EVIL EVIL EVIL hack but needed */
EDIT: I've yet to actually figure out what the "hack" is in the surrounding code...

Re: Funny comments in your OS's Source code?

Posted: Tue May 06, 2014 9:00 am
by Bender
I actually took this from somewhere else....

Code: Select all

/* Compiling this System for Windows? Huh? */
#ifdef __WIN32
/* Required for Windows, Maybe that's why Windows is slow and unresponsive sometimes? */
#define if while 
#endif
Maybe putting an '#error' there is better. :P
EDIT: _WIN32 is defined by most Windows compilers maybe I'll use that one.
To make matters worse let's try this:

Code: Select all

#define volatile // this one is cool
or why not just include the entire preprocessor_fun.h? Found the original awesomeness here: https://gist.github.com/aras-p/6224951

Re: Funny comments in your OS's Source code?

Posted: Tue May 06, 2014 1:50 pm
by blasthash
Not many funny things in my OS source yet (all of 260 lines so far :roll: ) but I have been known to put some funny things in my iOS development sources, especially in my other personal projects.

Code: Select all

somewhere:
// Apple gonna be mad when they see this code

somewhere else:
// Just kidding. Apple doesn't read my code. Too good for them
A few of my other favorites:

Code: Select all

In Java:
// Make sure on these compound operations you catch all your IOExceptions and make it as complex-looking as possible to woo the girls taking Visual Basic

One of my favorites of all time - when I read this source to this day I laugh - in C++:
// Too lazy to declare namespace std; it looks like a colonoscopy up in here