Funny comments in your OS's Source code?
- DavidCooper
- Member
- Posts: 1150
- Joined: Wed Oct 27, 2010 4:53 pm
- Location: Scotland
Re: Funny comments in your OS's Source code?
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
MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming
- thepowersgang
- Member
- Posts: 734
- Joined: Tue Dec 25, 2007 6:03 am
- Libera.chat IRC: thePowersGang
- Location: Perth, Western Australia
- Contact:
Re: Funny comments in your OS's Source code?
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.
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;
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
- Bender
- Member
- Posts: 449
- Joined: Wed Aug 21, 2013 3:53 am
- Libera.chat IRC: bender|
- Location: Asia, Singapore
Re: Funny comments in your OS's Source code?
@thePowersGang:
Should we make an 'Acess' swear count? lol we already have a Linux counterpart.
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)
(R3X Runtime VM)(CHIP8 Interpreter OS)
-
- Member
- Posts: 1146
- Joined: Sat Mar 01, 2014 2:59 pm
Re: Funny comments in your OS's Source code?
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:
EDIT: I've yet to actually figure out what the "hack" is in the surrounding code...
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 */
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
Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
- Bender
- Member
- Posts: 449
- Joined: Wed Aug 21, 2013 3:53 am
- Libera.chat IRC: bender|
- Location: Asia, Singapore
Re: Funny comments in your OS's Source code?
I actually took this from somewhere else....
Maybe putting an '#error' there is better.
EDIT: _WIN32 is defined by most Windows compilers maybe I'll use that one.
To make matters worse let's try this: or why not just include the entire preprocessor_fun.h? Found the original awesomeness here: https://gist.github.com/aras-p/6224951
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
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
"In a time of universal deceit - telling the truth is a revolutionary act." -- George Orwell
(R3X Runtime VM)(CHIP8 Interpreter OS)
(R3X Runtime VM)(CHIP8 Interpreter OS)
Re: Funny comments in your OS's Source code?
Not many funny things in my OS source yet (all of 260 lines so far ) but I have been known to put some funny things in my iOS development sources, especially in my other personal projects.
A few of my other favorites:
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
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