OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 7:45 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 51 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
 Post subject: Re: Funny comments in your OS's Source code?
PostPosted: Mon Apr 28, 2014 10:31 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 27, 2010 4:53 pm
Posts: 1150
Location: Scotland
That one is good - the first one to make me laugh.

_________________
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming


Top
 Profile  
 
 Post subject: Re: Funny comments in your OS's Source code?
PostPosted: Mon Apr 28, 2014 9:11 pm 
Offline
Member
Member
User avatar

Joined: Tue Dec 25, 2007 6:03 am
Posts: 734
Location: Perth, Western Australia
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:
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;

_________________
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc


Top
 Profile  
 
 Post subject: Re: Funny comments in your OS's Source code?
PostPosted: Tue Apr 29, 2014 2:39 am 
Offline
Member
Member
User avatar

Joined: Wed Aug 21, 2013 3:53 am
Posts: 449
Location: Asia, Singapore
@thePowersGang:
Should we make an 'Acess' swear count? lol we already have a Linux counterpart.

_________________
"In a time of universal deceit - telling the truth is a revolutionary act." -- George Orwell
(R3X Runtime VM)(CHIP8 Interpreter OS)


Top
 Profile  
 
 Post subject: Re: Funny comments in your OS's Source code?
PostPosted: Fri May 02, 2014 9:57 am 
Offline
Member
Member

Joined: Sat Mar 01, 2014 2:59 pm
Posts: 1146
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:
/* 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...

_________________
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing


Top
 Profile  
 
 Post subject: Re: Funny comments in your OS's Source code?
PostPosted: Tue May 06, 2014 9:00 am 
Offline
Member
Member
User avatar

Joined: Wed Aug 21, 2013 3:53 am
Posts: 449
Location: Asia, Singapore
I actually took this from somewhere else....
Code:
/* 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:
#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

_________________
"In a time of universal deceit - telling the truth is a revolutionary act." -- George Orwell
(R3X Runtime VM)(CHIP8 Interpreter OS)


Top
 Profile  
 
 Post subject: Re: Funny comments in your OS's Source code?
PostPosted: Tue May 06, 2014 1:50 pm 
Offline
Member
Member

Joined: Tue May 06, 2014 12:19 am
Posts: 31
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:
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:
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 51 posts ]  Go to page Previous  1, 2, 3, 4

All times are UTC - 6 hours


Who is online

Users browsing this forum: Sa41848 and 30 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group