Slashdot Mirror


Linux Kernel Code Humor

An anonymous reader writes "This article points to some pretty funny comments and code in the Linux kernel. From colorful metaphors, to burning printers, to happy meals... A recursive search through the entire code base reveals some interesting language. Is all code like this?"

84 of 485 comments (clear)

  1. Is all code like this? by EnderWiggnz · · Score: 5, Funny

    Yes.

    Haven't been working long in the real world, eh?

    --
    ... hi bingo ...
    1. Re:Is all code like this? by Ponty · · Score: 3, Informative

      If yours is, you won't either. I've heard of a few people who've gotten burned by sexist/offensive comments in their code.

    2. Re:Is all code like this? by saskboy · · Score: 3, Funny

      Do you remember about that software package that was mentioned on /. about the coder that was fired for putting a comment on the "help" button:
      "What kind of an idiot needs help with this?"

      Not an exact quote, but you get the idea. He was fired, and the company sent letters to their customers explaining that they didn't think they were idiots afterall.

      --
      Saskboy's blog is good. 9 out of 10 dentists agree.
    3. Re:Is all code like this? by KMitchell · · Score: 5, Informative
      Um, I have to disagree with this. It really depends on the shop. If by professional you mean formal code reviews by peers, perhaps that would limit some of this stuff. Knowing that you have to stare down a bunch of co-workers is a pretty good way to cause self-censure. Even then it really depends on the attitudes of the people that are going to be looking at your code. Some groups are really anal about comments and others couldn't care less if the code works.


      Now when the customers SEE these msgs, you really get to see what kind of company you work for... at a former gig we had a debug mechanism which caused a debug msg to be displayed when the program crashed in in debug mode. Theory was, the customer would never see these msgs but they were helpful for debugging. Some customer happened to run "strings" on the executable and since they're compiled (unlike comments), got to see a whole lot of messages along the lines of "we should never get here" etc. Kind of funny, really. The customer thereafter put out an anual list of interesting strings found in the program and everyone got a chuckle out of it. None of my comments ever made the list tho ;)

    4. Re:Is all code like this? by Anonymous Coward · · Score: 3, Funny

      Not really. I had a boss once whom I could tell had been fiddling with my code by the off-color comments.

      Other great comments I've seen:
      "Now we can go to the nth dimension and see superman!"
      "I think this works. I'd know for sure, but it's 3:47 AM and I want to go home."
      "F this code."
      checkin comment - "I suck."
      checkin comment - "Removed unholy blight that is X."

      Then there's the scary comments. They're typically about 12 lines long, include directions to talk to somebody, and precede a line of code as deceptively simple as "x += 2;".

    5. Re:Is all code like this? by Hayzeus · · Score: 3, Insightful
      Provided the language is inoffensive, this is simply not the case with most outfits.

      No comments at all are (rightly) far more likely to get you fired.

    6. Re:Is all code like this? by FlemLion · · Score: 3, Informative

      Only in a politically correct going to the uncivilized country will this lead to someone getting fired. What's the problem with some extra comment ?
      Have a lot more trouble without comment.

      Now picture the following:

      - some developers are writing a scanner driver for a medical scanner
      - at some exotic combination of resolution, size and so on, the driver gives an embedded image instead of the real one
      - during development this is a bikini calendar
      - someone forgets to replace this image and put in the team foto
      - a hospital in Iran decides to use a front end to automatically calculate the scanning parameters and guess what ? It hits those specicific values and ... there is the bikini, in Iran

      Talk about an incident. This even stirred political comment.

      Do you think people got fired ???
      In PC world (like the USA) probably for sure.
      And today it might be a reason in Europe too.
      But 10 years ago the repercussions in the European firm concerned did not go that far.

      So get a life, there's more than just code in code.

    7. Re:Is all code like this? by kbrannen · · Score: 5, Funny

      More than you'd initially suspect. :-) I used to work for a Wall Street firm that had the policy that if you worked more than 10 hours a day, they'd buy you dinner. We were on a tight schedule so this was very common for our small team. We rotated the "order dinner" duty around. Anyway, one day several months after the crunch, I was working on some code written by another guy and found something like this in the code. /* thu's order 2 canoli 1 raviloli 1 pepperoni pizza 3 salads 2 chocolate cakes 1 carrot cake 1 bread sticks 3 cokes 1 diet coke */ Looking back thru CVS, I found it had been there a good long while. After a good laugh, I deleted it.

    8. Re:Is all code like this? by rootmonkey · · Score: 4, Funny

      I typically listen to music while coding and lyrics find there way into my source code. I used to put weird ramblings in my source just to freak out the other developers. /* Its getting dark on the outer rim,insanity is startint to set in .... */. I've stopped doing that but many programmers put the personal touch on their code via comments.

      --

      Yes but every time I try to see it your way, I get a headache.
    9. Re:Is all code like this? by jaavaaguru · · Score: 3, Insightful

      The differnece between "12 hours working on it" and "12 hours fsking with it" shows how difficult the problem was to solve, and as far as I'm concerned could be useful to someone else looking at the code later. Leaving it in is only an option with code that stays in-house I guess.

    10. Re:Is all code like this? by FireballFreddy · · Score: 4, Funny

      Hehe, but code/comments like this can bite you in the ass too. I remember a developer who was told to add a big red button into a game for kids. For some reason, I believe as a joke, he put in a *huge* red button labeled "BIG FUCKING RED BUTTON".

      Well, the file got propogated to other trees before he could "correct" the button, and during pre-release testing a volunteer was playing the game and lo! the button pops up. :) Too bad it was an adult testing and not a little kid, because that would have been really funny.

      -FF

      --
      SQUEAK, the Death of Rats explained.
    11. Re:Is all code like this? by GlassHeart · · Score: 3, Insightful
      Is it just me, or do the words "professional" and/or "mature," when they occur next to "programmer," actually mean "conservative," or "humorless," or "full of him/herself?"

      Humor can co-exist with professionalism. However, source code is not where you put it. If you ever release that code to a customer, it could damage your company's reputation. Too many such comments could interfere with efforts to search the source code. Humor also often language- and culture-dependent, so your company's foreign employees may even misunderstand subtle jokes as actual useful comments about the code. And then it's no longer funny.

      Not to say that many such coding standards are little more than power trips. However, a professional will always keep in mind the fact that the source code doesn't belong to him or her. If you don't like the rules set by your employer, find another job.

    12. Re:Is all code like this? by BrokenHalo · · Score: 3, Funny

      Funny you should mention this... I remember some (i.e. many) years ago when I was working as a sysprog on a Sperry site, I wrote and implemented a transaction surveillance program called BIG_BROTHER. The CEO got wind of it somehow, and I got carpeted, so I renamed the prog to LARGE_SIBLING. That was OK, for some reason :-)

  2. Yes. by pb · · Score: 5, Funny

    The best code comment I heard about (in a discussion about code commenting, I believe) was something like this: /*** DRUNK -- FIX LATER! ***/

    --
    pb Reply or e-mail; don't vaguely moderate.
    1. Re:Yes. by danamania · · Score: 5, Funny

      I'm just compiling KDE 3.1 - in the middle of part of the code (for KATE the editor I think) is

      warning: why does this work?

      a grrl & her server

    2. Re:Yes. by inode_buddha · · Score: 5, Funny

      If you've ever compiled Enlightenment, you'll notice that it checks for Ale in libFridge (before invoking gcc proper), then it flames you for not having any Ale in Fridge...

      --
      C|N>K
    3. Re:Yes. by Ryan+Amos · · Score: 3, Funny
      Heh, I do that. Worst part was turning it in with my assignment not remembering that I had left the comment in there.. Code worked fine, it just had a big

      // Note to self, this code written while really fucked up.. go back and check it later

      I'm sure my TA found it rather humorous...

  3. The Tao of Linux by Anonymous Coward · · Score: 5, Funny

    Something forms itself from the silent void of the empty mailing lists and the noisy chaos of the crowded mailing lists. It shapes and protects us, it entertains and challenges us, it aids us in our journey through the ether world of software. It is mysterious; it is at once source code and yet object code. I do not know the name, thus I will call it the Tao of Linux.

    If the Tao is great, then the box is stable. If the box is stable, then the server is secure. If the server is secure, then the data is safe. If the data is safe, then the users are happy.

    In the beginning there was chaos in Unix.

    Tanenbaum gave birth to MINIX. MINIX did not have the Tao.
    MINIX gave birth to Linux 0.1 and it had promise.
    Linux gave birth to v1.3 and it was good.
    v1.3 gave birth to v2.0 and it was better.

    Linux has evolved greatly from its distant cousins of the old. Linux is embodied by the Tao.

    The wise user is told about the Tao and contributes to it. The average user is told about the Tao and compiles it. The foolish user is told about the Tao and laughs and asks who needs it.
    If it were not for laughter, there would be no Tao.
    Wisdom leads to good code, but experience leads to good use of that code.

    The master Cox once dreamed that he was a Kernel. When he awoke he exclaimed: "I don't know whether I am Cox dreaming that I am a Kernel, or a Kernel dreaming that I am Cox!"
    The master Linus then said: "The Tao envelopes you. You shall create great code for Linux."
    "On the contrary," said Cox, "The Tao has already created the code, I will only have to find it and write it down."

    A master was explaining the nature of the Tao to one of his students:
    "Is the Tao in the VM subsystem?" he asked. "Yes," replied the master.
    "Is the Tao in the scheduler?" he queried again. "The Tao is in the scheduler."
    "Is the Tao even in the modules?". "It is even in the modules," said the master.
    "Is the Tao in the Low-Latency Patch?"
    The master frowned and was silent for much time.
    "You fail to understand the Tao. Go away."

    The Tao is the yin and the yang. It is the good and the evil, it is everything and yet it is nothing, it is the beginning and the end.

    The Tao was there at the kernel compile, and it will be there when the kernel panics.

    A novice user once asked a master: "Why compile in C when C++ is more popular?"
    "Why a monolythic kernel when Mach is more popular?"
    "And why use ReiserFS when ext2 is more popular?"

    The master sighed and replied: "Why run Unix when NT is more popular?"
    The user was enlightened.

    A frustrated user once asked a master: "My kernel has panicked, should I post to lkml?"
    "No," replied the master, "You will only bother the Tao."
    "Should I rm -rf?"
    "No, you will have wasted the Tao's time."
    "Well should I search the web?"
    "You will search for all eternity," said the master.
    "Perhaps I should try FreeBSD?"
    "Then you will have disgraced the Tao."
    "I suppose I could try gdb," said the user.
    The master smiled and replied: "Then you will have made the Tao stronger."

    A stubborn user once told a master: "I run version 2.2. I always have, and I always will."
    The master replied: "You are foolish and do not understand the Tao. The Tao is dynamic and ever changing. Linux strives for the perfection that is the Tao. It flows from version to version with peace."

    "So my Linux does not have the Tao, so what?" said the foolish user. "Oh your Linux is of the Tao," said the master. "However, the Tao of Linux follows the Tao of the C library. One day the C library will change, and your Linux will be left behind." The user was silent.

    An angry user once yelled at a master:

    "My Linux has panicked! What lousy software it is, I hate it so!"
    "You are insulting the Tao," said the master. "The Tao is everywhere bringing order to hundreds of networks, aiding thousands of users, and fighting that of which we call the 'lame.' Do not disrespect the Tao; however, the Tao will forgive you."

    "I apologize," said the user, "And I will be more forgiving the next time the Tao fails me."

    "The Tao has not failed you, it is you that has failed the Tao," said the master. "The Tao is perfect."
    The Tao decides if a kernel shall compile, or if it shall abort.
    The Tao decides if a kernel shall boot, or if it shall freeze.
    The Tao decides if a kernel shall run, or if it shall panic.
    But, the Tao does not decide if a box will have no hardware failures. That is a mystery to everyone.

    A young master once approached an old master: "I have a LUG for Linux help. But, I fail to answer my students' problems; they are above me."
    The master replied: "Have you taught them of the Tao?" he asked. "How it brings together man and software, yet how it distances them apart; how if flows throughout Linux and transcends its essence?"
    "No," exclaimed the apprentice, "These people cannot even get the source untarred."
    "Oh, said the master, "In that case, tell them to RTFM."

    A master watched as an ambitious user reconstructed his Linux.

    "I shall make every bit encrypted," the user said. "I shall use 2048 bit keys, three different algorithms, and make multiple passes."
    The master replied: "I think it is unwise."
    "Why?" asked the user. "Will my encryption harm the mighty Tao, which gives Linux life and creates the balance between kernel and processes? The mighty Tao, which is the thread that binds the modules and links them with the core? The mighty Tao, which safely guides the TCP/IP packets to and from the network card?"
    "No," said the master, "It will hog too much cpu."

    The core is like the part of the mind that is static. It is programmed at a child's creation and cannot be changed unless a new child is made; unless a new kernel is compiled.
    The modules are like the part of the mind that is dynamic. It is reprogrammed every time one learns new knowledge; every time one learns better code.
    One is yin, the other yang. Each is nothing without the other.

    A novice came to lkml and inquired to all the masters there: "I wish to become a master. Must I memorize the Linux header files?"
    "No," replied a master.
    "Must I submit code to Bitkeeper?"
    "No," replied the master.
    "Must I meditate daily and dedicate my life to Linux?"
    "No," replied the master again.
    "Must I go on a quest to ponder the meaning of the Tao?"
    "No. A master is nothing more than a student who knows something of which he can teach to other students."
    The novice understood.
    And thus said the master:
    "It is the way of the Tao."

    A user came to a master who had great status in lkml. The user asked the master: "Which is easier: implementing new features to the kernel or documenting them?"
    "Implementing new features," replied the master.
    The confused user then exclaimed:
    "Surely it is easier to write a few sentences in the man page than it is to write pages of code without error?"
    "Not so," said the master. "When coding, the Tao of Linux opens my eyes wide and allows me to see beyond the code, to let the source flow from my fingers, to implement without flaw. When documenting, however, all I have to work with is a C in high school English."

    He who compiles from the stable tree is stubborn
    and unwilling to change, but is guaranteed reliability.
    He who compiles from the current tree is wise but perhaps too conformist, but is guaranteed steadiness.
    He who compiles from the unstable tree is adventurous and is guaranteed new innovations: some good, some bad.
    He who compiles straight from Bitkeeper is brave but guaranteed turbulence.
    They are all of the Tao. One shall respect the old, and debug the new; none shall argue over which is greatest.

    There once was a user who scripted in Perl: "Look at what I have to work with here," he said to a master of core, "My code is interpreted dynamically, the syntax is unique and simple, I have sockets, strings, arrays, and everything I could ever need. Why don't you stop meddling in C and come join me?"
    The C programmer described his reasoning to the scripter: "Script is to C as ebonics is to Latin. If the scripter does not grow beyond that of which he scripts, he will surely [die]. Besides, without C, how can there be script?"
    The scripter was enlightened, and the two became close friends.

  4. Re:Cool by DaBj · · Score: 5, Funny

    Does naming a temporary boolean variable SchroedingersCat constitute humor?

    If so then, yes, programmers do have humor. (Atleast this one does...)

    --
    "GNU's not Unix....it's Linux" / Kami "kokamomi" Petersen
  5. Diary (and calendar) of a die-hard programmer by Gaxx · · Score: 4, Interesting

    In the days when I was a die-harder coder (unlike the current easy life as a part time manager and part time developer) I used to keep my diary and calendar in code comments - those were, of course, the days without funky handhelds with funkier PIM systems :-) *sigh* The good old days....

    --
    -- Gaxx
  6. Google Cache by Anonymous Coward · · Score: 5, Informative

    Linked off of article here.

    Easier to read too.

  7. Linus by DaBj · · Score: 3, Funny

    Is it true that there somewhere in the kernelcode is a comment by Linus saying:

    "//I wonder why this works"?

    --
    "GNU's not Unix....it's Linux" / Kami "kokamomi" Petersen
    1. Re:Linus by kasperd · · Score: 3, Informative

      "//I wonder why this works"?

      I couldn't find exactly that comment. This is as close as I can get:

      grep -ir 'wonder.*work' linux
      linux/net/ipv4/arp.c: I wonder why people believe that they work.
      linux/drivers/acorn/block/fd1772.c: * code - I wonder if it will still work... No :-)
      linux/drivers/nubus/nubus.c: * I wonder how the CRC is meant to work -

      --

      Do you care about the security of your wireless mouse?
  8. Bolixed. by danamania · · Score: 5, Funny

    Around the middle of July last year the drive in my web server (a 10 year old 250mb SCSI) died. The first I knew about it was an error along the lines of "device is bolixed".

    It's about the most accurate error message I've seen yet - within half an hour it just wouldn't spin :)

    a grrl & her server

  9. Sometimes, and it can cause problems too. by Anonymous Coward · · Score: 5, Interesting

    A couple years ago the company I'm working for had sold the source to one of their business commerce systems to another company. The comments were sprinkled with some superlatives such as 'fuck' and 'son of a bitch' not to mention that there were a few other not-so-nice comments about other products like 'since this fucking windows bug' or what not heh. This other company was NOT very happy at all. It resulted in one person being let go when there were some small "budget" problems even though they just sold some software for over a million and this company wasn't very large (under 20). After he was let go they hired 3 new people. Lukly I just started about a week before this happened so I never got in trouble. Anyway, now the management scans the comments periodically to look for colorful words.

    1. Re:Sometimes, and it can cause problems too. by coyote-san · · Score: 4, Insightful

      The saddest thing is that the managers will never understand that they're responsible for their own problems. There are a lot of valid reasons for easing somebody out of the door, but the style of comments acceptable at the company before the merger is not one of them.

      N.B., I am not defending comments that are abusive to coworkers, slanderous, etc. That type of language has no place in an office.

      But the tone of a comment is a valuable indication of how much effort was put into fixing it. If I see a comment like // workaround, some_library_call() isn't working like advertised

      it tells me that they RTFM but found a workaround. Maybe a future version of the library (or the FM) will get it right. I probably don't need to talk to the author before touching the code myself. In contrast, a comment like // fucking windows refuses to allow us to keep both widgets visible at the same time, so we'll do this instead...

      tells me that they put a lot of effort into finding a solution to the problem, but every attempt failed. If I have an idea, I should talk to the author to see if he's already tried it. (Better yet would be a pointer to some internal document detailing everything they tried.)

      This isn't absolute - many people will never let their comments contain any emotional tone, and others will swear at the slightest problem. But it's a valuable tool when it's used properly.

      (Speaking of bugs, why does slashcode insist on merging paragraphs?)

      --
      For every complex problem there is an answer that is clear, simple, and wrong. -- H L Mencken
    2. Re:Sometimes, and it can cause problems too. by RetroGeek · · Score: 3, Informative

      a tie is a most useless piece of cloth

      History of the tie

      --

      - - - - - - - - - - -
      I am a programmer. I am paid to produce syntax not grammar. Deal with it.
    3. Re:Sometimes, and it can cause problems too. by Reziac · · Score: 3, Interesting

      idSoftware had a little util called "unfuck" that they would apply to their source before sending it off to the latest licensee. Gee, I wonder why? :)

      Somewhere in one of the Paradox 3.5 for DOS executables, someone left a brief rant on upper management (it's readable text in the executable). Betcha that was some interesting source...

      --
      ~REZ~ #43301. Who'd fake being me anyway?
  10. Hardly by barzok · · Score: 5, Funny

    I've seen code from one of our vendors with comments such as "whoever wrote this should be shot. but it was probably me. no time to fix it." He both admitted it was sketchy code and said it like that - and then we bought it.

    I've been known to "talk to myself" in my comments, but I do keep it PG-rated or cleaner. Sometimes at a function exit point you'll see "all done, have a nice day".

  11. Well no, it's not all like that by kfg · · Score: 5, Funny

    Only the best code written by the coolest people in a great working enviroment is like that.

    I think that's the real reason MS won't release code. It isn't that the code sucks and they'd be emabrassed ( because that cat is already out of the bag), it's that it would reveal what a dull lot the lot of them were and make it hard to recruit.

    I bet you won't find *one* "Fuck Clippy" comment in the whole code base, and you know they *want* to say it.

    Damned marketroids won't let people have *any* fun.

    KFG

    1. Re:Well no, it's not all like that by fizban · · Score: 3, Insightful

      I actually think there's probably plenty of "Fuck Clippy" messages in Microsoft code, and they won't release it because it would show how much they hate themselves.

      The developers in Microsoft can be quite at odds at the organization itself, like in any company...

      --

      +1 Insightful, -1 Troll. What can I say, I'm an Insightful Troll.

    2. Re:Well no, it's not all like that by plover · · Score: 3, Interesting
      I beg to differ. Excel '95 had far and away the most elaborate Easter egg I've ever seen. It was a built-in 3D Doom-style temple. You could walk around a la first-person shooter and read the names of the developers on the walls.

      Naming an empty macro "Magic 8-ball" in Word '95 and putting it in the toolbar would give you a magic 8-ball shaped icon that would randomly spew the "Don't bet on it" or "Reply hazy-try later" kind of answers when you clicked on it.

      Easter eggs weren't the exclusive province of the Office development team, either. The first 3D text screen saver under NT 3.51 had a couple of Easter eggs. Typing BEER into the text would bounce around names of beers. Typing VOLCANO would bounce around names of volcanos.

      But once the temple thing was made public in the wild, Microsoft got all suity and made a big stink about it, and they claimed they'd fire anyone responsible for putting any new Easter eggs into any Microsoft product.

      --
      John
  12. Hardware On Drugs! by mdechene · · Score: 5, Funny

    My personal favorite is the "Hardware On Drugs" message.

    cd /usr/src/linux
    grep -r drugs *

    linux-2.4.19/drivers/net/wan/dscc4.c:
    printk(KERN_INFO) "%s: hardware on drugs!\n", dev->name);

    --

    Karma: Not Particularly Funny.
  13. FreeBSD's /usr/src/sys/pci/if_rl.c by flynn_nrg · · Score: 5, Funny

    Bill Paul, the guy who coded the Realtek 8139 driver put a very funny comment:

    /*
    * The RealTek 8139 PCI NIC redefines the meaning of 'low end.' This is
    * probably the worst PCI ethernet controller ever made, with the possible
    * exception of the FEAST chip made by SMC. The 8139 supports bus-master
    * DMA, but it has a terrible interface that nullifies any performance
    * gains that bus-master DMA usually offers.
    *

    1. Re:FreeBSD's /usr/src/sys/pci/if_rl.c by Door-opening+Fascist · · Score: 3, Informative

      I have this card on a PII-350MHz Red Hat Linux machine, and an integrated one in a 1.3GHz Celeron laptop dual-booting Windoze 2000 and Debian Linux. In Linux, I never get above 5MB/s on a 100baseT-FX link, but in Windoze the limit is around 1.5MB/s. I guess Windoze has even worse support for this chipset than Linux.

  14. at my last job by pizza_milkshake · · Score: 3, Interesting

    i was reprimanded for extensive offensive language in my code. how else to keep it interesting?

  15. Re:The netcat code by sirket · · Score: 5, Interesting

    Ahh found the exact line:

    /* linux, which is trying as desperately as the gnu folks can to be POSIXLY_CORRECT. I think I'm gonna hurl... */ -- *Hobbit*, taken from the netcat source

    -sirket

  16. Re:Anyone remember by sczimme · · Score: 4, Funny


    someone talking about "Kernel Klink" embedded somewhere?

    Of course not - we know NOTH-ING!

    --
    I want to drag this out as long as possible. Bring me my protractor.
  17. Funny comments from other systems by Anonymous Coward · · Score: 5, Interesting

    In the VM subsystem for the Sun-3 kernel, about late 1986 I think, there appeared the following:

    panic("Shannon and Bill say this can't happen");

    One of the first mass market Unix boxes was sold through the now-defunct line of Tandy computer stores and contained a 68000 and a Z-80 as an I/O processor. They apparently had problems with the Z-80 going insane periodically. This would be noticed by the 68000 which would then...

    panic("Beam us up Scotty, she's sucking mud again");

    Of course the most famous of all is the comment in the task switching code of the original v6 Unix (Lyons commentary era) which said ... /* You are not expected to understand this */

    1. Re:Funny comments from other systems by Anders · · Score: 3, Insightful

      Of course the most famous of all is the comment in the task switching code of the original v6 Unix (Lyons commentary era) which said ... /* You are not expected to understand this */

      And, of course, it means something like "this won't be on the exam". See Odd Comments and Strange Doings in Unix for more of this kind of fun.

    2. Re:Funny comments from other systems by taniwha · · Score: 4, Informative
      but the funny thing was that it made lots of sense .... I did a V6 port (a long time ago and to the Vax no less) and worried about that line over and over again ..... I'd keep coming back to it and puzzle and worry over it .... one day I got there and it made absolute sense .... I'd won! .....

      Basicly what was going on was that fork() internally was a routine [newproc()] that returned 1 or 0 depending on whether you were the parent or the child .... and one of two things happened ... either you had enough memory, allocated it, copied the parent, and fudged up a return stack in the child to get back to return 0 (or 1 I forget which). But if you didn't have enough ram you'd swap out the parent and dummy up the swapped out image as the child, and set this bit in the process state saying you needed to return from newproc() somewhere in the swapper - which is why this comment was there - suddenly in the middle of a routine that returns no value it would test a flag, fudge the stack and return '1'.

  18. Variable Names too.... by RebelTycoon · · Score: 5, Funny

    One can be very colorful with variable names too.

    I remember my high school computer teacher made us make a pixel drawing program. Part of the specs was to be able to toggle between draw and move mode.

    The natural variable names were...

    PenIsUp and PenIsDown ...

    1. Re:Variable Names too.... by __past__ · · Score: 4, Informative
      Not to mention the unheard cries of thousands of VB code monkeys:

      On Error GoTo Hell

      Or in general

      GoTo ConsideredHarmful

      GNU has a whole page with (more or less) funny variable names

    2. Re:Variable Names too.... by YrWrstNtmr · · Score: 3, Funny

      We had one like that recently:

      something to do with revenue in the "pipeline" (future/expected)

      MyPipeFirm
      MyPipeNotFirm

    3. Re:Variable Names too.... by JohnFluxx · · Score: 3, Funny

      I remember someone telling a story (on /. maybe - i forgot) about they called their new program "enis", but the custom was to add a "D" for development, and a "P" for production. They didn't want to ship the customer a product called Penis, so the managers changed it to "Pnis" iirc, which still sounds the sound when pronounced.

  19. Re:Is all code like this? (I hope so!) by jdkane · · Score: 3, Interesting

    I think a sense of humor represents the imaginative side of the programmer. I find that programmers with a sense of humor often produce more creative solutions and aren't as afraid of the code or the solutions compared to their more staunch, anal-retentive counterparts. The coder with a sense of humor seems to live for creative endeavour of the coding, and in my opinion often produces a better solution sometimes even faster because they are enjoying the process. And if the humor gets reflected in the code then so be it -- we call all share in the laughs.

  20. Ok, what's interesting is: by dagg · · Score: 3, Interesting
    This guy was looking for something that was:

    I was looking for something terribly complicated and looking awesome to the eye...

    ... to put on a T-shirt. Most all his replies consisted of expletives and weird crap found in the kernel. Expletives are just more interesting than elegant code, I guess.

    --
    Sex - Find It
  21. The worst I ever saw by cca93014 · · Score: 5, Funny
    while working on a large (more than 3 million Sterling worth) financial risk system I found a comment that read:
    /* The following code demonstrates a complete and utter lack of professionalism. */
    The contractator that wrote it was long gone by the time anyone noticed it...

  22. Amusing Bits by DarkKnightRadick · · Score: 5, Funny

    I was compiling Perl 5.8 when I found these funny little tidbits:

    From Perl 5.8.0's ./Configure:
    "Checking to see how your cpp does stuff like catenate tokens...
    Oh! Smells like ANSI's been here.
    We can catify or stringify, separately or together!"
    "You have POSIX termios.h... good!"

    Gimp 1.2.3 was no less immune:

    checking for intelligent life... not found

    Both were found during the ./configure stages of compiling the source.

    --
    "There is a way that seems right to a man, but its end is the way of death." Proverbs 16:25 (NKJV)
  23. Funny printk in die_if_kernel for sparc64 by Etyenne · · Score: 5, Funny

    And colleague and I where working a client E450 when we saw some funny ASCII art in /var/log/messages. At first, we believed that the machine got owned and the cracker was making fun of us. A little grepping later we found it in arch/sparc64/kernel/traps.c die_if_kernel() (around line 1450 for 2.4.18). I'd like to post the snippet, but the lameness filter refuse to let me do so. Go see for yourself.

    BTW, kerneltrap.org comment posting system seem borked ... it ate my post !

    --
    :wq
    1. Re:Funny printk in die_if_kernel for sparc64 by Controllers · · Score: 5, Funny

      #arch/sparc64/kernel/traps.c
      /* Amuse the user. */

      \|/ ____ \|/
      "@'/ .. \`@"
      /_| \__/ |_\"
      \__U_/

      thats hilarious!!!

      --
      You have 30 Moderator Points! Use 'em or lose 'em!
  24. Encourage this! by dmorin · · Score: 5, Funny
    Ya know, I'll take goofy comments over no comments anyday. As long as somebody can come along later and understand what you meant, it's fine. If having fun with it causes you to write a small explanatory paragraph rather than just writing things like "Added new feature", everybody wins.

    Compare this to the boss I had that told me I wasn't allowed to call a variable "temp" (for temperature), because other programmers on the team might misunderstand and think that's a temporary variable.

    • char *dummy = ... ; ... free(dummy); // Because hey, free dummy.
    • History: Took out previous feature. I have no idea what I was smoking. I'm really very, very sorry.
    • And Lo, there came forth a Great Renaming, wherein the Lord did provide a mighty shellscript, and it did crunch upon the code for forty megs and forty bytes, and on the last day, all occurences of the expression "oldCompanyName" had become "newCompanyName", forever and ever, amen.
  25. Proper code indentation by Cadre · · Score: 5, Funny

    I ran across this gem awhile ago, been saving it as a text clipping on my desktop for years now waiting for the perfect moment to post:

    Halfway down the code there is a comment that looks something like this:
    **SFS 07/05/96** Third day. Still no sign of an indented IF. Food and water is running out and the bearers are getting restless. I think Carruthers is going mad...

    - Shane Smith <Shane.F.Smith@Healthnet.com> on proper code indentation, in comp.os.vms

    --
    All editorial writers ever do is come down from the hill after the battle is over and shoot the wounded.
  26. Cray-3 compiler declaration by ColonelPanic · · Score: 5, Funny

    While working for a loony British midget at Cray Computer Corporation, I put the declaration "short volatile *VP;" into the compiler's optimization phase.

    --
    "Skill shows through where genius wears thin." -Wittgenstein || Religion: uniting aviation and architecture.
  27. some suprises from apps by ElOttoGrande · · Score: 5, Funny
    Once was compiling xscreensaver and for some reason didnt have bc library installed...

    configure: error: Your system doesn't have "bc", which has been a standard
    part of Unix since the 1970s. Come back when your vendor
    has grown a clue.

    and one from the slackware adduser script..

    ~# adduser

    Login name for new user []:
    Come on, man, you can't leave the login field empty...

    i also remember a good one in the enlightenment configure script though i dont have it saved .. something about searching the -lfridge for lager ;)

  28. shutdown.c by almeida · · Score: 3, Funny

    While neither in Linux nor in the the kernel, there is some humor in shutdown.c (/usr/src/sbin/shutdown) in both FreeBSD and OpenBSD. The function die_you_gravy_sucking_pig_dog gave me a good laugh when I saw it the first time.

  29. Dutch code! by desaster · · Score: 5, Funny

    Here's my favourite part of the Blender source:

    #ifdef WIN32
    static int is_a_really_crappy_nvidia_card(void) {
    static int well_is_it= -1; /* Do you understand the implication? Do you? */
    if (well_is_it==-1)
    well_is_it= (strcmp((char*) glGetString(GL_VENDOR), "NVIDIA Corporation") == 0);

    return well_is_it;
    }
    #endif

    1. Re:Dutch code! by ntp · · Score: 3, Insightful

      Not pointless. It's saved in a static variable so glGetString and strcmp are only called once, even if the function is called a million times.

      --
      I control the time!
  30. after I was laid off ... by e1en0r · · Score: 5, Funny

    from my old job at a dot com I was instructed to make the website "self-maintaining". I was laid off on a friday but was told I had to spend the next week doing this. I remember one of the last scripts I worked on had something like this:

    if ( $get_out_while_you_can == $or_they_will_fuck_you ) {
    $with_a_cold_aluminum_baseball_bat = 1;
    }

    and

    if ( $this_company_is_run_by_morons == $i_hate_them_all ) {
    die();
    }

    1. Re:after I was laid off ... by Sayjack · · Score: 3, Insightful

      Companies which lay people off, then let them code for the remaining 2 weeks are pretty naive. The last thing you want in your system is a pissed off coder.

      I'd rather have a hacker in my system than an angry coder any day. They should get a clue.

      --

      -- Good judgement comes with experience. -- Experience comes with bad judgement.

  31. Any other /. references in Linux kernel? by VZ · · Score: 5, Funny

    I wonder why nobody has mentioned this:

    % sed -n 2,5p ./net/core/netfilter.c
    * Heavily influenced by the old firewall.c by David Bonn and Alan Cox.
    *
    * Thanks to Rob `CmdrTaco' Malda for not influencing this code in any
    * way.

    1. Re:Any other /. references in Linux kernel? by echucker · · Score: 5, Funny

      % sed -n 2,5p ./net/core/netfilter.c
      * Heavily influenced by the old firewall.c by David Bonn and Alan Cox.
      *
      * Thanks to Rob `CmdrTaco' Malda for not influencing this code in any
      * way.

      Ahh, good to see that there is some code out there with no spelling errors ;-)

  32. redefines the meaning of 'low end.' by kfg · · Score: 4, Interesting

    I guess this is why Road Runner stuck me with one of these things.

    They probably don't pay as much per unit as a decent chocolate bar.

    It brings up an interesting use for having source though, even if you don't code. Before buying a particular bit of hardware it might be interesting to read the driver comments to see what the programer thought of the thing at the low level.

    KFG

    1. Re:redefines the meaning of 'low end.' by silvaran · · Score: 3, Funny

      Hahaha, melts in your PC, not in your hand...

  33. Strangely enough ... by Aceticon · · Score: 4, Interesting

    ... (or maybe not) i usually find more funny comments in code from people who actually like coding (and are good at it) than from code monkeys .

  34. Ex-girlfriend commentary as assembly line labels by QuasiEvil · · Score: 5, Funny

    Several years ago, there were three of us, all working (well, "working") for our university's solar car team. Most of the telemetry code was written by one of the other guys (whose basement I'm now writing this from), and somewhere mid-project his girlfriend royally screwed him over. As we now tell people, it wasn't that she was a raving bitch, it was just that she really, really liked guys. All of them, everywhere, personally and intimately. :)

    Anyway, getting on with the story, after that event, he cranked out phenominal amounts of microcontroller code - all very intricate, clever, and good (from an engineer's point of view, not necessarily from a comp-sci view). However, written in assembly, he was forced to regularly come up with line labels for jumps in the code. These rapidly devolved from useful things like :CRC16UpperCalc before the girlfriend disaster to things like :LivsABitchDieDieDie afterwards. Made for some very funny looks back at the old code, but rather frustrating for anybody to debug. After all, how was I supposed to know the difference between the functionality of one with three "die"s and one with four "die"s. And yes, there was a difference, and yes, he knew exactly what each did.

    Lousy maintainability, but it was microcontroller code that nobody would ever again touch. Or, based on what we know of the teams after us, even understand. :)

  35. from code I used to work on by ucblockhead · · Score: 5, Funny
    #ifdef THOSE_BASTARDS_CHANGE_THE_SPEC_BACK_AGAIN
    // lots of code
    #endif

    This text is here because the above code triggers the lame filter. You know, that thing they put in the slash code to force crapflooders to be creative.

    --
    The cake is a pie
  36. How about a flow chart? by John+Ineson · · Score: 5, Funny

    arch/i386/kernel/dmi_scan.c
    [...]
    /*
    * Check for clue free BIOS implementations who use
    * the following QA technique
    *
    * [ Write BIOS Code ]<------
    * | ^
    * < Does it Compile >----N--
    * |Y ^
    * < Does it Boot Win98 >-N--
    * |Y
    * [Ship It]
    *

  37. from a professional shop by shortscruffydave · · Score: 5, Funny

    I work in a professional software house, and a while back I write a utility to trawl through some source code for an application and extract the comments. The ratio of 'practical' comments to frustration-venting, sideswiping and humour ran at about 50:50.

    One member of the team has a reputation for doing useful but wacky things, and most of examples of his code were prefixed with /* Trust me...I know what I'm doing */

    At some point a bug-fix had been applied by a junior programmer, prefixed by /* don't trust me...I may not know what he was doing */

  38. Half-Life SDK comments by sheetsda · · Score: 5, Funny

    See here and my sig.

  39. Re:The purpose of comments is to be USEFUL... by gilroy · · Score: 3, Insightful
    No. A purpose of comments is to be useful. As the bazillion examples posted here show, there are apparently other uses for comments, such as to let off steam, amuse oneself (or one's peers), or just be clever.


    Unless the spurious commenting actively obstructs maintenance -- and it's hard to imagine how it could do that -- it's perfectly fine if it's funny, witty, or (gasp!) off-task. Work is done better by those who enjoy themselves doing it.

  40. We need more comments like this! by coyote-san · · Score: 5, Interesting

    While this comment is humorous, it's also very deep. It shows that the coder understood what he was doing well enough to know that the behavior wasn't as expected... and anyone else touching the same code should expect problems.

    It's rare, thankfully, but it is possible for code to trigger obscure compiler or even CPU bugs. These can be virtually impossible to track down, esp. if your boss is (justifiably) skeptical of your claim that the problem has to be in the compiler. In these cases the best you can do is flag the code as something that's very flaky.

    (BTW, I have some personal experience with such code. I just hit one with a PNG decoder - one mode had a rare decoder error that would flip one pixel, but the mode meant that the error was propagated across multiple scan lines. A very careful review of the code showed no error, and when I tested the code on different hardware (a PC, not an embedded device) it worked perfectly on the same images. Therefore it has to be the cross-compiler or hardware, and all I could do was document the problem.)

    --
    For every complex problem there is an answer that is clear, simple, and wrong. -- H L Mencken
  41. Sadly, not too much in FreeBSD. by bahwi · · Score: 3, Funny

    Not too much in FreeBSD running the same tests. (Yes, I have nothing better to do today, thank you). (Results white-space edited)

    Under /usr/src/sys/
    $ egrep -ir "( fuck)|( shit)" *
    alpha/tc/esp.c: * Things are seriously fucked up.

    dev/sym/sym_hipd.c: * brain-deaded stuff that makes shit.

    i386/i386/math_emu.h: * structure to 12 bytes which breaks things in math_emulate.c. Shit. I

    Doing it outside the /usr/src/sys/ tree has many more results, but alot of them come out of the fortune files. No funny stories I could find, but I'm sure someone else can. =)

  42. Grepping kernel src... by hdparm · · Score: 3, Funny
    ...is indeed amusing, especially when you just woke up, drinking first coffee. Few favourites (comments):

    fs/reiserfs/inode.c: /* crap, we are writing to a hole */

    drivers/usb/uhci.c: * is just crap, written by a committee.

    net/ipv4/tcp_input.c: /* Old crap is replaced with new one.

    drivers/sbus/audio/cs4231.c: * how this crap gets set.

    drivers/net/3c501.c: Do not purchase this card, even as a joke. It's performance is horrible

    net/ipv4/ip_sockglue.c: I have no idea, how it will masquearde or NAT them (it is joke, joke :-))

    net/ipv4/tcp_input.c: * Funny. This algorithm seems to be very broken.

  43. Mental note by msobkow · · Score: 5, Funny
    /**
    * Do not accept contracts from D. Smith, as
    * it will lead to a tedious, boring, mind-
    * numbing term in the ninth level of hell.
    * 2002.01.04 MSS
    */
    --
    I do not fail; I succeed at finding out what does not work.
  44. My favorite C variable name by JWhitlock · · Score: 3, Funny

    while (e_coyote)
    {
    /* code goes here */
    }

  45. Burning Printers by Alien54 · · Score: 3, Informative
    The full story on Burning Printers can be seen here

    And apparently, originally it was a very legitimate error message.

    Another bit of lore and trivia for the mad scientist to know

    ;-)

    --
    "It is a greater offense to steal men's labor, than their clothes"
  46. Re:The purpose of comments is to be USEFUL... by Elwood+P+Dowd · · Score: 3, Interesting

    Work is done better by those who enjoy themselves doing it.

    This is a common misconception. Unhappy, overly criticized workers are less likely to make mistakes, and get more accomplished. In the general case. Extensive research on the subject has been published, although I'm not interested in hunting it down.

    --

    There are no trails. There are no trees out here.
  47. ASCII Art comments by Drakonian · · Score: 3, Interesting
    This is ironic. Yesterday, I was enraged at the embedded system compiler I was using and put in a very large ASCII art warning against doing something that you SHOULD be allowed to do that took 30 hours to debug.

    If you ever need ASCII art comments, head here:
    ASCII Generator. It can use many different "fonts". Great utility.

    --
    Random is the New Order.
  48. Example I found by sheriff_p · · Score: 3, Funny

    Not in the kernel, but ... (and this was in Perl code, so, make your own inferences):

    # SUB-PEN.
    # Of post-Soviet-Russian variety, with Chechens and a whole bunch of
    # paintable action figures so you can recreate your very own news
    # broadcast! Parents, dare you deny your children this fabulous
    # opportunity of becoming journalists? Too much caffine has been had.

    --
    Score:-1, Funny
  49. Re:Horse & Pig reference in Kernel 2.4.20 by kasperd · · Score: 3, Informative

    Does anyone know how to do grep for "ant" (exact word by itself)? :)

    Lots of answers, but most of them not really good. How about reading the man page. After doing that, I came up with this:
    grep -ir "\<ant\>" *

    The use of -i is simpler than specifying every letter could be upper or lower case. And the use of spaces at each end of the word misses those cases where where other chars are used at the word boundaries. Then better use the grep builtin feature to indicate start and end of a word.

    --

    Do you care about the security of your wireless mouse?
  50. Mainframe humor: BDOLVB by cant_get_a_good_nick · · Score: 4, Interesting

    I remember reading this as part of a warning really. There was a mainframe app, and there was a constant, and it was called BDOLVB. Some maintenance programmers inherited the system, and saw the obove constant, and didn't know what the hell it was. They tried to look it up, figure out what the meaning was, and they couldn't figure it out. They could see what it was set to, 1770 Octal, but didnt know what it meant. They put looking into it on the back-burner - the system worked but they were stil curious about the meaning. Eventually, after months, they found oout what it meant.
    1770 = BirthDate Of Lidwig Van Beethoven
    Since they spun their wheels for a few days tracking this down, they weren't smiling all that much at the cleverness of this.

    The thing to remember is that code is harder to read than to write. The author has context, information that the reader doesn't have and has to guess at. If you want to be funny, do so, but don't interfere with the ultimate goal of source, to make it easy for people to see and change your code.

  51. Mozilla and clearing history by Pinky · · Score: 3, Informative

    I was trying to find out how to clear the history from XUL in mozilla when suddenly ->

    The comment above the code for clearing the history in mozilla is something like /**** No honey, I haven't been visiting any porn sites. ****/

    Mozilla has lots of stuff like that.

    I mean this is how you import the standard library ->

    xmlns="http://www.mozilla.org/keymaster/gatekeep er /there.is.only.xul"

  52. Re:You are not expected to understand this by jericho4.0 · · Score: 3, Funny
    That was a good read, and on-topic also, but the most interesting phrase was;
    The very first use of Unix in the "real business" of Bell Labs was to type and produce patent applications
    There's someting both inspiring and disturbing about that.
    --
    "A language that doesn't affect the way you think about programming, is not worth knowing" - Alan Perlis