Slashdot Mirror


Why MS is Not Opening More Source Code

mario_grgic writes "Apparently inappropriate code comments is one of the reasons according to this story. I wonder what kind of things developers put in comments that would be so bad for the rest of us to see?"

104 of 526 comments (clear)

  1. comments? by Anonymous Coward · · Score: 5, Funny

    /* Nothing for you to see here. Please move along. */

    1. Re:comments? by G-funk · · Score: 2, Funny

      I've got comments like that. Before some API code I didn't want other developers using (stupid java's lack of a friends keyword) I had this: /* This code isn't really here *waves hand mysteriously, dates supermodel */ .... nasty sql code .... /* mmmm, supermodel */

      --
      Send lawyers, guns, and money!
  2. Best of the 'inappropiate comments' by rednip · · Score: 5, Funny
    • for a good time call June x12345
    • Linux rules!
    • It's like patching a Damn made of sawdust!
    • Man, this code sucks!
    • ToDo: this looks like a security hole (repeated 4689 times)
    • (got any more!)...
    --
    The force that blew the Big Bang continues to accelerate.
    1. Re:Best of the 'inappropiate comments' by Anonymous Coward · · Score: 5, Funny

      I prefer to think the most inappropriate comment possible would be:

      GNU General Public License, version 2.0

    2. Re:Best of the 'inappropiate comments' by over_exposed · · Score: 2, Insightful

      Probably just a bunch of four-letter variables that would offend anyone older than 27....

      --
      "The object of war is not to die for your country, but to make the other bastard die for his." - Patton
    3. Re:Best of the 'inappropiate comments' by Anonymous Coward · · Score: 5, Funny

      Cmon. UNIX comments are way funnier.

      My personal favorite:

      /* You are not expected to understand this. */

    4. Re:Best of the 'inappropiate comments' by Tehrasha · · Score: 2, Funny

      Im sure there are alot of offensive 'Master' and 'Slave' comments in DOS too..

    5. Re:Best of the 'inappropiate comments' by Zocalo · · Score: 5, Informative

      Well that's a little out of context, but there is a short page about "odd" comments in UNIX which includes an explaination of the abovehere.

      --
      UNIX? They're not even circumcised! Savages!
    6. Re:Best of the 'inappropiate comments' by Anonymous Coward · · Score: 3, Funny

      I wonder if it is the 'inappropriate comments' or the 'inappropriate code'. Replacing the comments in code is easy but replacing the code is hard. Here is an example of what I mean (yes, a colleague actual did this once):

      public class JohnQPublic {
      public void GettinMyHo (int daBooty) { ...
      } ...
      }

      public class PimpDaddy{
      public GettinSome() {
      JohnQPublic johnDoe = new JohnQPublic();
      int inDaAss = 100;
      johnDoe.GettinMyHo(inDaAss); ...
      } ...
      }

      Except "John Doe" was usually people he didn't like. He wrote an entire program like this once. It was hilarious. Eventually he got fired for some other stupid nonsense, but this was a classic piece of code. The funny thing was, the program worked great...just a bit of a pain to maintain after he was gone ;)

    7. Re:Best of the 'inappropiate comments' by mungtor · · Score: 5, Funny

      Probably much more like: /* well, Bill is still a douchebag, so here goes the "extended" standard crap */

      or /* Instead of doing this right, we'll just keep doing it our way */

      and don't forget /* let's see those Open Source assholes figure this one out */

    8. Re:Best of the 'inappropiate comments' by Ba3r · · Score: 3, Funny

      that is usually followed by a:
      // W T F

    9. Re:Best of the 'inappropiate comments' by GordoSlasher · · Score: 4, Funny
      I found my favorite Unix comment while browsing through the Unix sixth edition source (yes this was a loooong time ago). Embedded within reams of commentless code was:

      /* this is a comment */

    10. Re:Best of the 'inappropiate comments' by enyalios · · Score: 3, Funny

      grep -R chainsaw /usr/src/linux

    11. Re:Best of the 'inappropiate comments' by devilspgd · · Score: 3, Funny

      It's too bad no IDEs support search and replace.

      --
      Give a man a fish, he'll eat for a day, but teach a man to phish...
    12. Re:Best of the 'inappropiate comments' by shawn(at)fsu · · Score: 2, Funny

      I've seen
      ToDo: Make this work

      I laughed each time I saw it.

      --
      500 dollar reward for tip(s) leading to the arrest of the person(s) who stole my sig.
    13. Re:Best of the 'inappropiate comments' by Midnight_Blue · · Score: 2, Funny

      My favorite: /* drunk.... fix later */

    14. Re:Best of the 'inappropiate comments' by Brandybuck · · Score: 5, Funny

      I see that one all the time in the proprietary code base at work.

      --
      Don't blame me, I didn't vote for either of them!
    15. Re:Best of the 'inappropiate comments' by Aeiri · · Score: 5, Interesting

      My favorites are the ones from the "drivers/net/sunhme.c" file of the Linux Kernel:

      /* Welcome to Sun Microsystems, can I take your order please? */ ... /* Would you like fries with that? */ ... /* Anything else? */ ... /* Fifty-two cents is your change, have a nice day. */

      /* We have a special on GNU/Viking hardware bugs today. */ ... /* Will that be all? */ ... /* Don't forget your vik_1137125_wa. Have a nice day. */

      /* foo on you */

      /* Lettuce, tomato, buggy hardware (no extra charge)? */

      /* We're consolidating our STB products, it's your lucky day. */ ... /* Come back next week when we are "Sun Microelectronics". */ ... /* Remember: "Different name, same old buggy as shit hardware." */

      /* Only Sun can take such nice parts and fuck up the programming interface
      * like this. Good job guys...
      */

    16. Re:Best of the 'inappropiate comments' by Profane+MuthaFucka · · Score: 2, Funny

      My favorites: // Check for Dr. DOS, and exit if true // If this were Linux, lpt1: would be on fire. // Uh oh, somebody's looking. Enable A20. // Copyright 1989 IBM Corp.

      --
      Fascism trolls keeping me up every night. When I starts a preachin', he HITS ME WITH HIS REICH!
    17. Re:Best of the 'inappropiate comments' by igb · · Score: 5, Informative

      For those missing the joke, the hme ethernet
      interface gets its name from the `Happy Meal'
      ethernet/SCSI combo card, so named because
      you get both interfaces as a discount deal.
      The same chipset went onboard some machines, too.
      The PCI version (Happy Meal was SBus) I think
      was named Fresh Choice (two trips to the ASIC
      salad bar) after the valley eateries, but I
      might be misremembering.

      ian

    18. Re:Best of the 'inappropiate comments' by mpe · · Score: 3, Interesting

      I prefer to think the most inappropriate comment possible would be: GNU General Public License, version 2.0

      As well as any other comment which implies piracy. If the developers are working on code they never expect to be seen by "outsiders" they are unlikly to be concerned about "borrowing" someone else's code.

    19. Re:Best of the 'inappropiate comments' by Anonymous Coward · · Score: 2, Interesting

      Actually pulling in any GPL'd code is a good way to get yourself fired at Microsoft. They are pretty careful about that sort of thing.

      Now BSD licensed code, on the other hand, is all over the place in their projects.

    20. Re:Best of the 'inappropiate comments' by jzap · · Score: 4, Funny

      Or the Rene Magritte variant:
      /* This is not a comment. */

    21. Re:Best of the 'inappropiate comments' by Bert64 · · Score: 2, Informative

      There was also a predecessor chip to the HME called the Big Mac.. so it's not coincidence that they were using mcdonalds names for their products, i'm just surprised they didnt get sued.

      --
      http://spamdecoy.net - free throwaway anonymous email - avoid spam!
    22. Re:Best of the 'inappropiate comments' by ozbird · · Score: 2, Funny

      /* Drunk - fix later */

    23. Re:Best of the 'inappropiate comments' by gilesjuk · · Score: 2, Interesting

      Well the article does mention IP issues. So it shows that closed source code can have licensing/patent issues also.

    24. Re:Best of the 'inappropiate comments' by MadMoses · · Score: 4, Funny

      Best comment I ever saw was an unused char array in some C code, initialised with all '0's, and the comment //here we insert some zeros to keep the code fluffy and airy

      --

      Do not be alarmed. This is only a test.
    25. Re:Best of the 'inappropiate comments' by Ashtead · · Score: 2, Funny
      The scary parts are the error messages from that file (drivers/net/sunhme.c) rather than the comments. Unlike the comments, they can be revealed to the word at large, and, since they are error messages, they will appear in a context of "my bloody network card has stopped and I'm only getting daft jokes about it!", which is probably nowhere near as funny as what was might have been intended. Of course, I have no idea about how likely this is to happen; it could be that this is a rare or obsolete unit whose inclusion might have been mandated by some PHB...

      Some of the funny printk() calls can at least be called informative:

      printk(KERN_ERR "happy meal: Aieee, transceiver MIF read bolixed\n");
      printk(KERN_ERR "happy meal: Aieee, transceiver MIF write bolixed\n");
      printk(KERN_ERR "%s: Aieee, link timer is asleep but we got one anyways!\n");

      Then there are the rather less informative:

      printk(KERN_ERR "happy meal: Transceiver BigMac ATTACK!");
      printk(KERN_ERR "happy meal: Receiver BigMac ATTACK!");
      printk(KERN_ERR "happy meal: Fry guys.");
      printk(KERN_ERR "happy meal: Transceiver and a coke please.");
      printk(KERN_ERR "happy meal: Eieee, rx config register gets greasy fries.\n");
      printk(KERN_ERR "happymeal: Would you like that for here or to go?\n");

      The author's opinion of the Sun hardware aside, it stops just short of telling off the end-user for using such hardware.

      --
      SIGBUS @ NO-07.308
    26. Re:Best of the 'inappropiate comments' by Anonymous Coward · · Score: 2, Funny

      As well as any other comment which implies piracy.

      /* Whoever designed this API should be made to walk the plank. */
    27. Re:Best of the 'inappropiate comments' by Crayon+Kid · · Score: 2, Informative

      Ahh, the joys of grepping for "fuck".

      arch/mips/pci/pci-ip27.c:
      /*
      * IOC3 is fucked fucked beyond believe ... Don't even give the
      * generic PCI code a chance to look at it for real ...
      */
      if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16)))
      goto oh_my_gawd;
      arch/sparc/kernel/ptrace.c:
      /* Fuck me gently with a chainsaw... */
      net/core/netfilter.c:
      /* James M doesn't say fuck enough. */
      And of course
      /* Fuck me plenty... */
      which occurs several times in the Linux kernel. I wonder who it was.
      --
      i ate crayons when i was a kid and now i have two braincells and the blue ones taste nicer
    28. Re:Best of the 'inappropiate comments' by MikeBabcock · · Score: 3, Funny
      /* I don't know why, but this seems to fix a bug */
      if (**a[4] > *(b+6))
      return;
      Not that I've ever written such a thing ...
      --
      - Michael T. Babcock (Yes, I blog)
  3. grep by mmkkbb · · Score: 5, Funny

    /* The word 'fuck' is here so you can grep for it */

    --
    -mkb
  4. ha by momerath2003 · · Score: 5, Interesting

    Heh, no surprises here. I mean, from what we've seen from the leaked windows source...

    --
    I had but a simple dream, to destroy all humans.
    1. Re:ha by RonnyJ · · Score: 4, Informative

      Actually, the first link there isn't from Windows source code, it's from the source of a Linux USB camera driver (as you can see when you look at the parent post to it).

  5. "Linux Rocks!!!" by jdray · · Score: 4, Funny
    10 REM Linux rocks!!!
    20 Do(stuff);
    --
    The Spoon
    Updated 6/28/2011
  6. I wonder... by PornMaster · · Score: 4, Funny

    // horribly insecure, but we had to meet a ship date...

    1. Re:I wonder... by Brandybuck · · Score: 2, Interesting

      Seen in real life: /* IMPORTANT: comment out the following before release */

      This was above a section of code that gave the developer a gaping back door into the system for debug purposes. The code in question had been out in the field for over five years.

      --
      Don't blame me, I didn't vote for either of them!
  7. Programmers do to comment. by kngthdn · · Score: 5, Funny
    ...

    /* Man I hate this fricking company */
    LineTo(hdc, LOWORD(lParam), HIWORD(lParam));
    ReleaseDC(hwnd, hdc);
    }

    fDraw = NULL;
    return 0L;

    /* Nobody reads this crappy code anyway */
    case WM_MOUSEMOVE:
    if (fDraw)
    {
    hdc = GetDC(hwnd_global);
    MoveToEx(hdc, ptPrevious.x, ptPrevious.y, NULL);
    LineTo(hdc, ptPrevious.x = LOWORD(lParam),

    /* I wish I could stick this at the top of the WndProc... */
    SendMessage(hwnd, WM_DESTROY, 0, 0);

    ...

  8. Well... for starters... by Duncan3 · · Score: 5, Funny

    /* Copyright © 2000 Apple Computer, Inc. All rights reserved. */

    --
    - Adam L. Beberg - The Cosm Project - http://www.mithral.com/
    1. Re:Well... for starters... by NanoGator · · Score: 4, Insightful

      "/* Copyright © 2000 Apple Computer, Inc. All rights reserved. */" /* Special thanks to Xerox */

      --
      "Derp de derp."
    2. Re:Well... for starters... by aristotle-dude · · Score: 3, Informative

      I think you are forgetting that MSFT stole some Quicktime code to create WMP.

      --
      Jesus was a compassionate social conservative who called individuals to sin no more.
    3. Re:Well... for starters... by ajna · · Score: 2, Insightful

      http://imprint.uwaterloo.ca/issues/100298/3Science /science01.shtml
      http://news.com.com/MS+to+invest+150+million+in+Ap ple/2100-1001_3-202143.html

      "Both Apple and Microsoft executives denied that the Microsoft investment represents a path to converging the companies' operating systems. However, they said they had agreed to work out a settlement to a long-standing dispute over whether Microsoft's Windows operating system infringes on any of Apple's patents."

      http://www.jmusheneaux.com/index02.htm#Major

      From the last link it's clear that Xerox lost, so the only FUD here is that of Xerox deserving credit.

  9. lol by Apreche · · Score: 2, Insightful

    grep -ri fuck /usr/src/linux

    I just wouldn't be open source without inappropriate comments.

    --
    The GeekNights podcast is going strong. Listen!
  10. Hard habit to break. by shotgunefx · · Score: 5, Interesting

    I used to pepper my code with vulgarities. Then clients wanted copies on their own hosts. It's a hard habit to break.

    Particularly when debugging scripts. "F*CKING C*NT" and the like weren't to uncommon.

    An interesting tidbit, Viaweb (now Y! Store) used to have a program called storef*cker :)

    --

    -William Shatner can be neither created nor destroyed.
    1. Re:Hard habit to break. by jbarket · · Score: 4, Funny

      I had the exact same thought when I read the summary.

      A few years ago I was hired to do web application development because of my skills in one language, but I was hired to write in another. So, since I began doing for-production work in a matter of days, I had a lot of simple errors.

      I used to step through my code by placing either "Fuck yeah!" or "Shit's broke" inside and outside of different condition statements.

      Then one day some idiot on the team decided it would be a good idea to randomly show the clients my incomplete, not live code for whoknowswhy, and in the middle of the page at random was "SHIT!"

      Been trying hard to break that habit since :D

      --

      -----
      jonathan barket
    2. Re:Hard habit to break. by slashrogue · · Score: 4, Funny

      Been trying hard to break that habit since :D

      I hope you mean breaking that idiot of the habit of showing clients random and incomplete code ;)

    3. Re:Hard habit to break. by noidentity · · Score: 4, Funny

      An interesting tidbit, Viaweb (now Y! Store) used to have a program called storef*cker :)

      Must have been a b*tch to invoke from the command line, with an asterisk in the name and all.

    4. Re:Hard habit to break. by PeanutGallery · · Score: 2, Interesting

      Yeah, back a couple of years ago when I was writing firmware for [Company name baleeted] we wrote a simple Winderz client driver to test our stuff against while the driver guys got the "official" driver working. Of course ours was peppered with bizarre comments (and worse, sceen messages).

      I still remember the day the MSCE's wandered in and confiscated our driver because they couldn't seem to make theirs work quite right. To this day I wonder how many calls tech support has gotten asking what the "She's gonna blow capn'!" dialog is all about.

      Lesson to all Noob's (and anyone else who hasn't had the pleasure): NEVER WRITE ANYTHING YOU WOULDN'T WANT YOUR GRANDMA TO READ! (Cuz you just never know where it'll turn up)

      --
      -- Just another unsolicited opinion... from the Peanut Gallery.
  11. How about this? by mtrisk · · Score: 4, Funny

    /* Taken from the Linux Kernel 2.6 DO NOT RELEASE UNDER ANY CIRCUMSTANCES, VIRAL GPL WILL HARM US */

    /* No one from the Debian Project shall ever see the following, lest you want your head chopped off! */

    /* These Samba guys figured it out, here's what they wrote */

    In all reality though, it's probably littered with expletives, like the Win2000 source code leak was.

    --

    Without a proper flamewar, Anonymous was undecided on what shell to run.
    1. Re:How about this? by ScrewMaster · · Score: 4, Interesting

      Yeah, well ... if you were a fresh-out-of-college coding grunt in a Microsoft sweat shop, believing that no-one would ever see your code but your co-workers and maybe your boss, you might be inclined to put some asinine comments in your code as well. That's not so surprising ... what is surprising is that those comments are still there. Which gives me an idea that maybe Microsoft doesn't run quite as tight as ship as they would like us to believe. Of course, we already knew that.

      --
      The higher the technology, the sharper that two-edged sword.
    2. Re:How about this? by lakeland · · Score: 5, Interesting

      Yeah yeah, YHBT and all that...

      Notice how the code snippet you pasted is inside #if? That means the preprocessor will strip it out at compile time, not run time... got that? Next you note that htons performs the same check. That would be the htons function right? There's this thing about functions... Every time you call them you have to push your state onto the stack, wasting cycles. That means your version will waste a processor cycles every single time it is called, but the linux one won't. We call this optimisation.

      What's that? Cycles don't matter? How frequently do you think the function above is called? Can you be certain it won't be called when performance is key? Lets be clear, there is some ugly code in the linux kernel, most of it is stuff written years ago that could be refactored if anybody bothered. But pointing to an optimisation and saying: look, that's redundant! is just foolish.

    3. Re:How about this? by damiam · · Score: 2, Informative

      The w2k source wasn't littered with explitives. There were a few, but much less than I'd expected (fewer than in the Linux kernel, which contains fewer LOC).

      --
      It's hard to be religious when certain people are never incinerated by bolts of lightning.
    4. Re:How about this? by Jondaley · · Score: 2, Informative

      I mentioned this the other day, but it also applies here.

      In Microsoft's WinCE IrDA driver it explicitly mentions why they aren't following the IrDA spec, to hack a fix for, "those stupid HP printers". Ironically, enough, I was testing an HP printer at the time, and wondering why CE wasn't following the spec, when the printer was. I think that is one of the only comments I have seen in the WinCE source. Presumably, they have been filtered out, unless they really just never comment anywhere.

  12. graph of fucks per line in the kernel by tepples · · Score: 5, Funny

    Better yet: The word 'fuck' is here so you can graph for it.

    1. Re:graph of fucks per line in the kernel by cmcguffin · · Score: 3, Funny

      I'm not sure what happened between 2.3.30 and 2.4.14, but apparently that shit is one craptastic penguin-fucking bastard!

  13. Automatically strip the comments out! by Anonymous Coward · · Score: 2, Insightful

    I am a delphi developer and often delve into the VCL source and the source of other third party components and these usually contain little or no comments which leads me to believe that the comments are automatically stripped out when the software is released to the world.

    So If Microsoft does this then there is one excuse down the drain, but how many more will there be?

  14. Examples by apoch2001 · · Score: 2, Funny

    /** * * This method will cause system to crash and *fustrate users * */ /** * * This section of code will steal personal * information from users and give us blackmail * ability * */

  15. Some suggestions... by mikael · · Score: 4, Funny

    what kind of things developers put in comments that would be so bad for the rest of us to see?"

    // I don't know what this value is for, but it seems to stop the BSOD from appearing

    --
    Vintage computer adverts: http://www.vintageadbrowser.com/computers-and-software-ads
  16. GPL by iMaple · · Score: 2, Funny

    /* This code is licensced under the GPL. Please read * the license carefully. Enjoy. */

    On the other this is impossible. I havent found any GPL code as bad as the MS code (Well of course I havn't looked at too many GPL programs and a single MS program :) )

  17. sometimes its things that get mis-interpreted by willCode4Beer.com · · Score: 4, Interesting

    One of my previous employers got slammed in the press one day because a code error let a web server comment get leaked into the HTML comments of a page. It said something along the line of being a work around for the whinny mac people. I don't remember exactly but, it was pretty innocent. They got written up in quite a few Mac related news articles as being anti Apple (when they were actually trying to support it).

    OTOH, there could also be missing comments. I think we've all entered projects with no documentation or usable code comments; where the lore of the project is passed from dev to dev.

    Or, they may have rushed so many projects that they are embarrased for anyone to see the code. Many companies and the military are guilty of this. Maybe they want some time to do a review / refactor.

    --
    ----- If communism is a system where the government owns business, what do you call a system where business owns govern
  18. Easy... by Epsillon · · Score: 5, Funny

    /* Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. */

    And a little further down...

    /* It's our TCP/IP thingy. We're gonna patent it. We own the Internet and all it's (sic) protocols. Resistance is fu... is fut... is useless */

    ;-)

    --
    Resistance is futile. Reactance buggers it up.
  19. Re:See the code, be the code by Anonymous Coward · · Score: 2, Insightful

    that is completely untrue.

    that is like saying once you have seen a book you cant be an author.

    it is literally the same expressiveness in both.

    you cannot memorize one in enough quantity to matter.

    looking is not the same as analyzing and studying it for a long LONG fucking LONG amount of time.

    you can get an idea of how things work without the time it takes to remember significant amounts of code.

  20. Examples of Comments MS Don't Want You to See by Nova+Express · · Score: 5, Funny
    ///**This is Security Hole which will force them to upgrade to XP Pro**///

    ///**This is the best I could do ripping off the feature from OS X; it will have to do until the next rev. Damn tricky Apple bastards...**///

    ///**These are not the comments you are looking for.**///

    ///**I pulled this right out of the Linux 2.4 source code! They'll never know!**///

    ///**Adobe incompatability code enabler; see Screwing the Competition, Volume 23 for Documentation**///

    ///**Man, I'd never get away with this shoddy hack if it weren't for our illegal OS Monopoly! Being evil rules!**///

    ///**Hey, wait a minute! THERE'S where that SCO Source Code went to!**///

    --
    Lawrence Person (lawrencepersonh@gmailh.com (remove all "h"s to mail)

    http://www.lawrenceperson.com/

  21. Re:Inappropriate comments.... by Anonymous Coward · · Score: 5, Funny

    Well, if ya look at the performance, it's pretty obviously not C.

  22. I believe it. I have a (very bad) similar story. by ip_freely_2000 · · Score: 2, Insightful

    A few years back, my company was interested in buying a component of our software in an OEM arrangement. We had a formalized code review meeting that spent three days on paper review of architecture and that sort of stuff

    The second part of the week was a code walkthrough highlighting certain parts of the tricky code. My software development manager, for some unknown reason, decided to leave in original comments from the developers which included
    - Dissatisfaction with a pay raise of only 22 percent
    - Disatisfaction of some coding policies I had asked my development manager to implement (real tough policies like add *some* comments in code to explain it
    - A reference to two of our female finance people

    The President and myself spent a very hard Saturday meeting reassuring IBM that while the comments were unprofessional, the code and archtiecture was sound. I came within a hair of losing my job.

    Yes, people were shown the door as a result, and I learned a big lesson on the difference between trust and due diligence.

  23. Inappropriate code comments by Matt+Perry · · Score: 2, Informative
    I like Philip Greenspun's take on inappropriate code comments. This paragraph stands out:
    Should one judge the author of this code, Cotton Seed, unprofessional because of his colorful source code (never visible to an end-user)? Or does he get credit for having made an honest effort to write a high-quality, useful piece of software and then giving it away for free, with source code so that others can build on his work?" And then further credit for calling attention to a potentially important issue with words that are unlikely to be overlooked?
    Personally, I feel that making your software freely available far outweighs any potentially shocking comments.
    --
    Slashdot: Failed Car Analogies. Amateur Lawyering. Anecdote Battles.
  24. Why use bad language in code? by 1000101 · · Score: 3, Insightful

    After reading some of the comments, I've come to realize that many people apparently use vulgar language and/or ridiculous comments in there code. Am I in the minority when it comes to not doing this? I really don't see the point actually. I don't like to comment anymore than the next guy, but when I do, it's usually there to help me out in the future (even if that's just tomorrow when I come back in to work). I would feel like an idiot reading my own code if it were riddled with comments like 'this fucking sucks!', or 'the front desk girl is so hot and has big tits!'.

  25. Quake III by Neo_Ludite · · Score: 5, Funny

    My favorite from the Quake III source
    i = 0x5f3759df - ( i >> 1 ); // what the fuck?

    1. Re:Quake III by Vengie · · Score: 5, Informative

      that line is used to compute a "fast inverse square root" -- google for 0x5f3759df and you'll learn a little math. [you see that number once and you remember it forever] the result is a rough hack of what the exponent should be.

      -b

      --
      When in doubt, parenthesize. At the very least it will let some poor schmuck bounce on the % key in vi. (Larry Wall)
  26. Re:Innapropriate comments? What the. by cnettel · · Score: 2, Interesting
    I really disagree here. Clever code may be one thing, but readable code should need very few comments except for the few really tricky parts. A few lines above each function desribing them (perharps Javadoc style) is good, but if you need to explain what you're doing for every line, your code is bad. Keeping comments describing what your bad code does to make it readable is a worse option than readable code -- twice the amount of data and you need to keep them synchronized. (What if the bad code really doesn't do what the good comment tells you that it does? A clear no-no.)

    A comment containing some profanity may not be the best way to do it, but I can understand the sentiment. A comment could be in place exactly to alleviate a "WTF" sensation for the prospective reader, it could seem that something strange is going on in the code, and we've written a description for why it is that way, maybe even after having debugged it ourselves.

    Good code with good variable naming in a good language needs little commenting. As I said, method header comments is another cup of tea, because those may more center around design decisions and the bigger picture, which might be harder to get just by reading the individual pieces of code, no matter how well-commented each piece is.

  27. Too many eggs by agent · · Score: 2, Funny

    http://www.google.com/search?safe=on&q=Office+97+e aster+eggs

    1. Re:Too many eggs by Headcase88 · · Score: 2, Informative
      --
      "When the atomic bomb goes off there's devastation...but when the atomic bong goes off there's celebraaaaation!"
  28. Best comment I ever saw by Gildenstern · · Score: 5, Funny
    The best comment I ever saw in a piece of code was from a friend that I was working on a group project with back in college. He sent me some of his work for the project and I was having problems getting it to work like he said it did so I was looking in the code and found

    /*Drunk, Fix this Shit Later*/

  29. Re:Innapropriate comments? What the. by Man+in+Spandex · · Score: 2, Informative

    Not every programmer out there works alone. When your code has to be viewed and worked on by other people, you better have comments explaining the things that aren't self-explanatory. (sorry if I didn't make that clear).

    Your code can be really clear using proper variables like iNumber, proper syntax and the works! But when you programming, you're putting in what you have in mind or on your plan. You don't want other programmers to "guess" what you were trying to do in "x-y" lines.

    When it's not self explanatory, you should have proper comments. The best way to test this is show your friends or fellow programming teammates and see see if they can guess right and I'm not talking about a "Hello World" kind of program.

  30. Let me tell you a lilttle story about Joe by Saint+Stephen · · Score: 2, Interesting

    The header to one of the DAO files in the Windows source tree said this when I read it (when I worked there). It said (paraphrasing): "Let me tell you a little story about a programmer named Joe. One time Joe tried to read and understand this code. (Bunch of stuff about how ugly the code was.) We don't hear much from Joe anymore. Last I heard, Joe was sorting mail at the post office."

  31. We all know the REAL reason... by St.Anne · · Score: 2, Funny

    10 rem this will screw those linux a***oles 20 print "copyright Microsoft 1982-2004" 30 goto 12000 40 rem stolen mac parts 50 for x= 1 to 100000 next 1 60 pause 1000 . . . 1200 goto 40

  32. Re:Slashdot And Microsoft by squall14716 · · Score: 2, Informative

    phpBB didn't shut down. The site was just compromised due to a hole in awstats. I'll take your post as a troll then.

  33. Same problem at Netscape by mike.newton · · Score: 2, Funny

    Seems Netscape had the same attitude before releasing the future Mozilla code in 1998: http://www.jwz.org/doc/censorzilla.html

  34. It isn't just the comments by fireman+sam · · Score: 2, Insightful

    Most of the comments here are about what funny things are said in the source code. I think a more interesting piece from the article is "These issues include intellectual property rights". This to me states that either they have licenced parts of the Windows Forms code from third parties, or (for those of you with tin foil hats, put them on now) they have "borrowed" parts of the code from third parties and do not want them to find out about it. Hmmm.

    --
    it is only after a long journey that you know the strength of the horse.
  35. Most likely: /* card is crap - workaround */ by dbIII · · Score: 2, Interesting
    I think the most likely comments that they don't want anyone to see would be along the lines of "hardware product X is crap, but this driver at least gets the pitious fools that buy it to be able to use it."

    Comments like that read by the wrong people end up with expensive legal action - paticularly if the product really is crap.

  36. Re:See the code, be the code by Detritus · · Score: 2, Insightful

    Bullshit. Running away in fear, just because someone might use your actions as a pretext for a lawsuit, is for cowards.

    --
    Mea navis aericumbens anguillis abundat
  37. Two examples by kbahey · · Score: 4, Funny

    Two projects I worked on had to deal with 'inappropriate comments':

    The first was when a reference to Black Sabbath (a music band) was in some comments. Normally, source is not given to customers, but in this case, it was a shell script, so it did go to customers.

    Those who asked for that change were from the useability group. The guy who had to fix it was the archtypical anti-social nerd, but had a strange sense of humor. He entered an issue in the bug/change tracking system saying something like 'change Black Sabbath comment as per customer request'. The irony is, source had the CVS $Log$ tag, which caused all the fix comments of CVS to be in the source [no matter that I thought it was a bad idea, and that 'cvs log ....' would get you the same info, a manager said "this is the standard here"], so the issue description got into the log comments, and Black Sabbath was there again! Ha!

    In another case, we had a product that relied on an open source but commerical product. That product was developed by nerds who used programmers' humor all over the help pages, ...etc. The customer was upset by the use of 'conversational English' in the documentation. We had to get someone from the technical writing team to rewrite those pages! Nevermind that the product was geared towards sysadmins and techies! Sigh.

  38. Re:And don't forget by karmatic · · Score: 2, Informative

    Actually, if you strings ftp.exe, it's

    "Copyright (c) 1983 The Regents of the University of California.
    All rights reserved."

  39. Probably the same as Netscape's code by marmite · · Score: 2, Funny

    Jamie Zawinski has a list of rude words which had to be removed from the Netscape client code before it could be open-sourced. Microsoft's probably looks a bit like this.

    http://www.jwz.org/doc/censorzilla.html

    --
    I do not represent myself.
  40. Microsoft... by Beatlebum · · Score: 2, Interesting

    I bet there are code comments inside CreateWindow saying feature X was added to assist Word/Excel/Powerpoint.

  41. A long time ago by mingot · · Score: 3, Interesting

    I was on the way to a job interview and remembered that they had requested a code sample. I remembered the nifty job I'd done on a DDE interface to netscape (it was small, clean code, and took quite a bit of research and teeth gnashing to get right). I located the source file, printed and printed it out.

    During the interview the hiring manager started going over the code with me and having me explain what it did, how it did it, etc. And then he got down to the /* This is fucking bizzare, blah blah */.

    I felt pretty sunk. Ended up getting the job, though.

  42. Being a consultant breaks you of that. by Anonymous Coward · · Score: 3, Funny
    You only do it once.

    I _do_ recall when a particular demo for a big client was going well, I was actually calming down (big mistake), etc. A weird path through the code was taken and what do I see?

    ***Eat my flaming cock, you hairy scrap of shit clinging to the ass of a decent developer, You should never have hit this exception. Please eat the stack trace, curl up, have massive convusions, and beg me for your life. Bring.a bottle of good scotch. -grs#***

    Printed in big, red letters on the app. (We have custom error handling, if that wasn't clear.) Note, this is in front of the investors who were financing the company I was working for.

    Learning how to sell that to an SVP and MajorCorp client is only the sort of thing you can learn on your feet. I never want to do it again, but it did, um, learn me real good. And I'm not sure what I did, or why they believed me.

    -Coward, guess why.

    #Initials changed to protect the guilty. Not like it matters too much now, but the fuckup, the boss and me all read this. Live and learn.

  43. Re:ever hear of grep? by BasilBrush · · Score: 3, Interesting
    Not really true if the point of the source being there is to step through the API when debugging, as it is here. Your're not debugging or maintaining the commentless code. So long as there is documentation on what the call is supposed to do, and the identifiers used in the code are at least somewhat reasonable, that's plenty.

    I used to work for an company that produced a commercial OS, and their policy was to discourage comments. Their goal was to make readable code, and when you are tempted to make a comment, that means the code was getting too complex and needed simplifying, or better choices of identifiers. Comments were a last resort, shunned as they tend to go out of date faster than the code. Unfortunately the ideal had only limited success, as writing legible code is a skill most coders don't possess. When the idea worked, it worked well. When it failed, you had unreadable code without comments.

  44. True hell by hkb · · Score: 4, Funny

    You know no hell until you use the goatse site as a test url in development and forget to take it out when the code goes live, and a user and then your boss find out before you do.

    --
    /* Moderating all non-anonymous trolls up since 2004 */
  45. More Sun-related Linux kernel gems by DragonHawk · · Score: 5, Interesting

    These all from 2.6:

    arch/sparc/kernel/ptrace.c:/* Fuck me gently with a chainsaw... */

    arch/sparc/kernel/head.S: /* XXX Fucking Cypress... */

    arch/sparc/kernel/sunos_ioctl.c: /* Binary compatibility is good American knowhow fuckin' up. */

    arch/sparc64/mm/init.c: /* Fucking losing PROM has more mappings in the TLB, but

    arch/sparc64/kernel/traps.c: /* Why the fuck did they have to change this? */

    Even better is this from 2.4:

    arch/sparc/mm/srmmu.c: Are you now convinced that the Swift is one of the
    biggest VLSI abortions of all time? Bravo Fujitsu!
    Fujitsu, the !#?!%$'d up processor people. I bet if
    you examined the microcode of the Swift you'd find
    XXX's all over the place.

    --

    dragonhawk@iname.microsoft.com
    I do not like Microsoft. Remove them from my email address.
  46. Nestled deep inside... by eremitic · · Score: 2, Funny

    /* I hope nobody finds those Tiger Beat photos... */

    --
    Warning: Could be fatal if taken seriously
  47. RTFA by t_pet422 · · Score: 2, Informative

    From that guys blog:

    The comments need to be scrubbed not because I know there is anything bad in there (I don't think there really is), it's that I can't be sure that there isn't. So getting rid of them completely is a brute-force approach to making sure nothing slips through. You have to understand that I'm operating in a very risk-averse environment.

  48. Re:Innapropriate comments? What the. by BasilBrush · · Score: 3, Insightful
    Yes, but if you are working in a decent OOP language there are very few occasions when you NEED code that is non self-explanatory. Writing legible code without relying on comments is a skill set that most programmers don't have, but it's perfectly possible. Whenever you're tempted to write an explanatory comment, just think about how the code could be written so that it's self explanatory without the comment. It might need more descriptive identifiers. It may need the lines that are being commented to be factored out into a local function with a descriptive name.

    The main exception is code that needs optimisation. But when you remember that isn't always to early to optimise code, and when you do optimise, you only optimise the small fraction of the code that has the most effect, then the ammount of code that needs comments is minimal.

    The other exception is commenting other peoples code that haven't written it in a legible fashion.

    P.S. Like the grandparent post, I'm not talking about function header comments, particularly auto documentation system comments - those are essential. I'm talking about comments mixed in with the code.

  49. The best I saw was in Jaguar Doom source by The+Tyrant · · Score: 2, Interesting

    The port of Doom for the Atari Jaguar was done largely by an automated tool which turned the C code into risc assembly, thus removing all meaningful lables, variable names, and comments from the source. It was then patched to get round the bugs in the processors, and thus contains no comments at all except for one, which apears often, of "FUCKING DSP!!!"

    No, really.

  50. Re:See the code, be the code by Feztaa · · Score: 2, Funny

    This is, of course, how it should be. Everybody knows that no successful author has ever read a book.

  51. Re:more info on minigirls by X0563511 · · Score: 2, Informative

    ...this is more than just a simple troll.

    Page contains a Java trojan. My AV reported:

    "Trojan horse TR/ClassLder.c.Java"
    "Trojan horse TR/Forten.Java.2.B"

    --
    For large sets, this will be our guide even unto death, for the LORD will work for each type of data it is applied to...
  52. Actually, I doubt it by Moraelin · · Score: 4, Insightful

    I doubt that anyone would place comments in code that basically boil down to "I hate my job and my employer." At the next code review, or the next time a bored coleague looks into your code, it's just begging to be used against you.

    If comments about the company or other co-workers are present, they'll more likely be a lot milder and kept to something you can sorta justify as just documenting code behaviour. E.g., "this is a work-around for Bug X in Function Y of the MSFC".

    On the other hand, there is plenty of room for utterly inapropriate comments about other companies and products. Think along the lines of "unlike the utter crap we took from the BSD monkeys, this one is 40 times faster and uses 10 times less memory." Or "this is here only because the monkeys from are too stupid to do their own buffer checking before calling my function."

    Excessive hubris is pretty much part of the job description for nerds. Remember kids, everyone else sucks and is an idiot luser. Only you can possibly know anything at all about computers. And only the skills you have (e.g., pushing the power button or typing "emerge kde") are l33t and cool, the rest is idiot luser stuff.

    But my guess is more like MS is just playing defensively. There are a lot of people and has-been companies that are out for MS's blood. Comments that noone minds in the Linux kernel, if found in MS code would get those people screaming for blood and gathering a proper medieval crowd with pitchforks and torches.

    I mean, look around. Even a comment as benign as "this is a work-around for bug X in function Y" would get half the MS-bashers on /. screaming and waving it around as definitive proof MS can only write bad code.

    Doubly so for those who:

    A) never wrote any productive code in their entire life, but think they're uber-l33t because they can run someone else's scripts (e.g., "emerge kde"), or

    B) wrote a 20 line program in BASIC once, or a 20 line BASH script, so they think they're qualified to pass judgment about 1,000,000 line projects or about whole languages

    (No offense intended to good programmers in either VB or various shell scripts. But there is a _massive_ and _fundamental_ difference between a 100 line program and a 100,000 line program. Stuff that works in the former, like, "bah, I wrote it just as well without all this fancy encapsulation and bogus design", might just cause the latter to never be finished or anywhere near working.)

    --
    A polar bear is a cartesian bear after a coordinate transform.
    1. Re:Actually, I doubt it by Moraelin · · Score: 4, Insightful

      If that's what you think, you might be in for a _very_ nasty surprise at some point.

      That nobody at the workplace cares about you in a good way, that's probably not a bad frame of mind. Cynical, that's true, but most of the time it's accurate.

      But you might be surprised who cares about you in a _bad_ way. Who's out on a personal quest to prove to the boss that your code is utter crap and you should be fired. Or at least he should be promoted before you.

      I've already posted one such true story on Slashdot (I fondly called it "Jack and Jill up corporate hill), where a marketeer-turned-programmer I know (and to my shame, which I've helped get into programming) made it a personal quest to get both female programmers on his floor fired. He succeeded too.

      He'd run with snippets of those programmers code to every single guy in the building, to show everyone what bad code they wrote. Invariably he was wrong, and just showed _massive_ incompetence, and their code was good. He didn't even know the most elementary _basics_ of Java, the language he's paid to program in. But obviously it wasn't obvious to the boss, seein' as he did get them both fired, and he got promoted.

      A more sad case was someone who couldn't program at all. No, not just "not a top programmer." He just couldn't write code that even compiled. At all.

      So a couple of co-workers took pity and started helping him. Well, not as much "helping", as outright writing his modules for him.

      So what does he do? Make it his personal quest to bad-mouth them to the boss behind their backs, and "prove" that they just interfere with his work and he surely would have done better if they hadn't edited his files. (Never mind that he had actually asked for their help to start with.)

      There's one important lesson in corporate cynicism there, grasshopper. The person you helped might be not a friend, and not even indifferent: you might have actually made an _enemy_. You're one of those who know he's incompetent, and that makes you dangerous. Worse yet, you might be seen as a good programmer, and as such in his mind (and usually _only_ in his mind) someone who might get promoted before him. You're an obstacle to be taken out of the way.

      How's that for being even more cynical? :P

      --
      A polar bear is a cartesian bear after a coordinate transform.
  53. Evil stuff we always suspected... by pleumann · · Score: 4, Funny
    /**
    * The following lines are required to break
    * DR-DOS compatibility. Don't remove!
    */
    and
    /**
    * Make sure our own application loads
    * quicker than all the competitors.
    */
    and
    /**
    * Keep this security leak. Sell antivirus
    * software later.
    */
  54. Wot, no "bodge"? by pommiekiwifruit · · Score: 2, Funny

    Obviously not enuff UKian developers.

  55. The real reason.... by HogynCymraeg · · Score: 2, Funny
    /* This piece of code stolen from SCO */
  56. Or how about... by HogynCymraeg · · Score: 3, Funny
    if(version=="95") delay = 100000;
    if(version=="98") delay = 90000;
    if(version=="ME") delay = 90000;
    if(version=="2000") delay = 80000;
    if(version=="XP") delay = 70000;
    if(version=="LONGHORN") delay = 60000; // more like forever *lol*

    sleep(delay);
  57. We already know by Relyx · · Score: 2, Funny

    This article investigating dubious comments appeared shortly after the Win2k source code was leaked.

  58. What comments are those? by mwood · · Score: 4, Interesting

    "I wonder what kind of things developers put in comments that would be so bad for the rest of us to see?"

    If you had done more coding, you would know. :-)

    "Stupid pointless [expletive deleted] for Marketing" or "This is dumb but the boss says Do It".

    "I have no idea why this works, so don't touch it!"

    "Kill 'em all, let God sort 'em out!!!" (on an instruction to skip over whitespace).

    And some actual examples I'd be embarrassed to repeat.

    I guess that when one spends all day writing bloodless prose for an unfeeling machine, commentary seems like the only emotional outlet one has. I've written a few comments which were, ah, amazingly vivid considering the humble nature of the operations they describe.