• (nodebb)

    This article needs to be commented, or deleted.

  • Simon (unregistered)

    Wasn’t there a famous one "You are not meant to understand this"?

  • Officer Johnny Holzkopf (unregistered) in reply to Simon

    Along with the official documentation that said: "Nobody wants to say how this works. Maybe nobody knows."

  • (nodebb)

    My favorite comment was 'Store AX register'. What made it special was that the code was 68000 assembler which does not have an AX register.

  • (nodebb)

    One of my professors told us about some code he worked with that only had one comment in it: "Turn the bugger on". He had no idea what the bugger was or what was happening that would be turning it on.

  • Duke of New York (unregistered)

    To be commented or deleted. That is the ?.

  • Dan Swartzendruber (unregistered) in reply to Simon

    I seem to recall the comment was "You are not expected to understand this" and was from the bowels of the original UNIX kernel...

  • Dr, Pepper (unregistered)

    Our company has a policy that all methods must be documented. Fortunately, the documentation is not code-reviewed; and fortunately GhostDoc can auto-generate the comments; so there are many methods documented like this:

    ///

    /// Noes the query results. /// /// <returns></returns> [HttpGet] public ActionResult NoQueryResults(string q) ...

        /// <summary>
        ///     Restrictions the error.
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ActionResult RestrictionError()
    
  • (nodebb) in reply to Rick

    Yeah, I once saw for a 286 assembly listing a comment about "accessing the zero page". Ah, that throw me back to those C64 times. Then again, the comment made not sense at all, however there were a ton of those in the listing, so I guess there was some mandated comment quote and the dev got bored and just wrote nonsense.

  • (nodebb)

    Years ago on a hobby project, I ran into something like "You don't want to know" and had to figure it out anyway. (It was a Forth variant, turns out the function just expected eight items on the stack in the right order. Far from the worst code I've ever personally run into.)

  • (nodebb)

    I'll just remind the regulars here of the one I found once:

        /* This doesn't work and I don't know why not */
    

    And, of course, it took me about ten minutes to work out why not, just by following the code around.

  • ricecake (unregistered)

    I like this one (from https://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered/482129#482129):

    // 
    // Dear maintainer:
    // 
    // Once you are done trying to 'optimize' this routine,
    // and have realized what a terrible mistake that was,
    // please increment the following counter as a warning
    // to the next guy:
    // 
    // total_hours_wasted_here = 42
    // 
    
  • (nodebb)

    Sometimes I leave comments along the lines of "I probably screwed up type conversion, but it works".

  • (nodebb)

    Not to mention all the ones along the lines of 'temporary hack. remove ASAP'.

  • (nodebb) in reply to thosrtanner

    In .net ´´´// HACK´´´ is actually something that shows up in the TODO list of Visual Studio - with obviously ´´´// TODO´´´. So at least there's some tooling support for those exact keywords for the last two decades.

  • NULL (unregistered)

    Sometimes you feel the need to leave a comment because you were forced against your will to do something bad.

    A few years ago I was told to use PKCS1_OAEP to encrypt some data, but the encrypted result had to be the same each time as it was to be used as a key in a datastore.

    So I was forced to override the random function it used to one that gave determinate values based on the data it was encrypting.

    Still to this day there is a comment begging forgiveness in the code.

  • King (unregistered)

    I saw this in assembler code from the 80's, right after a tricky part: "Neat, eh!"

  • Argle (unregistered)

    More than once I had students turn in assignments containing things like this:

    int x; // declare integer x

    Naturally I had to ask why. The routine answer was that their previous programming teachers expected every line to be documented, no matter how uselessly. I couldn't fault the students for this, of course, but there were some alleged teachers whose necks I wanted to wring.

  • (nodebb)

    That third one could well be mine, I've certainly left a similar one before. In my defense, the company was so toxic that there wasn't the opportunity to do things right. My recommendation to Samir is to get out ASAP.

  • (nodebb)

    That third one could well be mine, I've certainly left a similar one before. In my defense, the company was so toxic that there wasn't the opportunity to do things right. My recommendation to Samir is to get out ASAP.

  • (nodebb)

    That third one could well be mine, I've certainly left a similar one before. In my defense, the company was so toxic that there wasn't the opportunity to do things right. My recommendation to Samir is to get out ASAP.

  • löchlein deluxe (unregistered)

    I love how code formatting gone wild in the second example makes it sound like the gym teacher from Beavis and Butthead. (Or Dave Spokesperson, for people under 40?)

  • (nodebb) in reply to MaxiTB

    Probably ported from something that was written in 6502

  • Lubricant (unregistered) in reply to MaxiTB

    Accessing the zero page on a 286 probably referred to the display buffer. You'd be able to create a full page animation by writing to the graphic card memory section (page) that wasn't currently displayed, and then switch to it. It was very slow though, so unless absolutely necessary, it was more efficient to just animate sprites.

  • Neveranull (unregistered)

    My favorite comment I found in code I inherited was “Battlestar Galactica season premier tonight!”

Leave a comment on “Minimal Commentary”

Log In or post as a guest

Replying to comment #:

« Return to Article