How to spot a coders comment

This topic was created by Parax .

  1. Parax

    How to spot a coders comment

    So you can spot a T-SQL coder's comments because he uses 'single' instead of "double" quotes.

    A TCL Programmer uses {Braces} instead of (Brackets).

    I'm wondering how many other good tells for other languages are out there?

    1. TeeCee Gold badge

      Re: How to spot a coders comment

      Well, obviously a "C" programmer's comment will have made sense to them when they wrote it but, while syntactically and grammatically correct, will be impenetrably unintelligable to anyone trying to make sense of it later.

      1. Tim Parker

        Re: How to spot a coders comment

        "Well, obviously a "C" programmer's comment will have made sense to them when they wrote it but, while syntactically and grammatically correct, will be impenetrably unintelligable to anyone trying to make sense of it later."

        I think that might be Perl you're alluding to - surely the king of write-only languages.

        1. Yet Another Anonymous coward Silver badge

          Re: How to spot a coders comment

          Perl has comments?

          i thought the only comment you ever got in Perl was "?????? WHAT the F$%& ????" - which incidentally is a valid Perl program

        2. Brewster's Angle Grinder Silver badge


          A perl programmers comments would be written in abbreviations and punctuators, using "$" instead of"this" and "@" instead of "these" or die "not perl $!";

      2. Anonymous Coward
        Anonymous Coward

        Re: How to spot a coders comment

        As distinct from a Java coder's comment which tends to look like this:



        *this function bars Foos and returns a Snafu

        *@param bar a Bar

        *@param foo a Foo

        *@return a Snafu


        private Snafu foobar (Bar bar, Foo foo) {

        //Create a new Snafu passing bar and foo as parameters

        Snafu snafu = new Snafu(bar, foo);

        //do something with the data

        snafu.doSomethingWithThe Data();

        //now return the Snafu object

        return snafu;


        I think they get paid by the line, including comments

        1. Dan 55 Silver badge

          Re: How to spot a coders comment

          But, as this is Java, you've unfortunately forgotten the SnafuFactory.

          1. Anonymous Coward
            Anonymous Coward

            Re: How to spot a coders comment - @Dan 55

            I retire today, it's someone else's problem from here on.

        2. Greg J Preece

          Re: How to spot a coders comment

          I think they get paid by the line, including comments

          I do a lot of Java. I doc the shit out of my method and class headers, because it makes code inspection and merging later far easier, and the IDE will pick up on them. Within my methods though, I keep the comments to what's required. I go with the philosophy that comments should not explain what you're doing, but rather why you're doing it.

          1. This post has been deleted by its author

    2. disgruntled yank

      Re: How to spot a coders comment

      Not if the Tcl programmer wants his [comment] to be evaluated.

  2. LinkOfHyrule


    I take it the BASIC guys were big fans of the yet to exist rock band!

    1. Brewster's Angle Grinder Silver badge

      Re: REM

      10 REM my comment


  3. Khaptain Silver badge

    Who writes comments

    A Linux programmer - "Comments are for newbies."

    A Windows programmer - There is no point in writing comments because the language of the day changes far too often. ( 6 months is already an old coding library - .DotNet - no problem, which version/sub version, MFC anyone, WIN32 -- WTF is WIN32).

    A Cobol programmer - If someone needs to read comments to understand Cobol , they also need to change their profession.

    A RPG programmer - Does anyone still code in RPG......

    A Basic programmer - No need to write comments , they never get further than line 20

    10 : Print "My name is Michael"

    20 : Goto line 10

    An HTML programmer - <!-- This is commented out -->

    1. TeeCee Gold badge

      Re: Who writes comments

      Does anyone still code in RPG......

      There are a lot of indicators that this still goes on.....

    2. Anonymous Coward
      Anonymous Coward

      Re: Who writes comments

      I once had the job of rewriting a program written on a BBC micro to control a test instrument, using BBC Basic and written by a physicist. It needed to add an auto calibration routine and some data logging, but it did the job.

      The program was beautifully written and well commented. It was a pleasure to work with, the best piece of code I had seen in years.

      But I soon fixed that. We can't have these non-programmers coming in and raising the standards.

  4. BongoJoe

    An APL coder would be an Egyptiologist

  5. Thomas 4

    I write comments

    In fact I've just written one, right here.

    1. TeeCee Gold badge

      Re: I write comments

      Hmm, you must have worked here. Much of our shonky old code is littered with pointless comments that state the bleedin' obvious.

  6. JulianB

    My favourite comment

    discovered when investigating a program that wasn't quite working correctly (and the original programmer had left)


    1. Hungry Sean

      Re: My favourite comment

      This just happened to me!

      Except that the comment was less obviously a "to do"

      two end cases to handle in an algorithm, he handled the second, but had the detection for the first as well. The comment said something like "increase gain here" followed by several lines apparently modifying some gain parameters (but not actually increasing anything).


    2. Brewster's Angle Grinder Silver badge

      Re: My favourite comment

      assert( false && "unimplemented" );

    3. Greg J Preece

      Re: My favourite comment

      Which is why one of the last things I do before committing any code is have the IDE look up any @todo tags in my current module. ;-)

      Think my favourite comment was from my old boss, who left in one class:

      "I think I've got this working, but then it was written by <ex programmer>, and <ex programmer> was a lazy incompetent twat."

      1. Anonymous Coward
        Anonymous Coward

        Re: My favourite comment

        I've left comments like that.

        Worked with a lazy shit once who never documented the IP addresses assigned to 3rd party VPN NAT pools, so I used to mark them as..

        "<the lazy twat> has assigned these addresses to someone - I suggest you ask him. [date]"

        6 months later the file was still full of them - I think it's still that way to this day. God help anyone trying to audit them. (This was for a well known internet bank as well).

    4. larryk78

      Re: My favourite comment

      // TODO: remove this - it's fundamentally unmaintainable

  7. Caff


    Mainframe programmers use fixed width 80 char replies .

    1. PassingStrange

      Re: mainframe

      True IBM mainframe programmers don't use columns 73-80.

      1. John R. Macdonald

        Re: mainframe

        True IBM mainframe COBOL programmers don't use columns 1-6.

        1. Daniel von Asmuth

          Re: mainframe

          program Register( input, output);


          { CDC mainframe BASIC programmers use columns 72-80 to store line numbers }


  8. John Smith 19 Gold badge

    Or that one found in the source for a compiler.

    "This code is cursed."

    1 of about 3 comments in the listing.

  9. Anonymous Coward
    Anonymous Coward

    // 01/10/2010 temporary fix.

    Obviously, it's still there.

  10. Tom 7 Silver badge

    //see spec pg 20 par iii

    /* most lucid comment ever before code was refactored but miss

    ed the line feed*/

  11. Anonymous Coward
    Anonymous Coward


    new SpringObjectMappableCommentFactory().troll();

  12. Anonymous Coward
    Anonymous Coward

    No comment


    The post is required and must contain letters? Eh? WTF?

  13. Anonymous Coward
    Anonymous Coward

    Programmer Forth

    Comment Forth easy spot. Green if Yoda might be however.

    1. Brewster's Angle Grinder Silver badge

      Re: Programmer Forth

      : its not the " word order" that gives away a forth programmer ;

      its the " spaces" .

  14. Dale Vile, Freeform Dynamics

    Not about comments but...

    This thread reminds me of the user who phoned me one day many years ago saying an error message had appeared that he didn't understand. It read:


    1. Phil O'Sophical Silver badge

      Re: Not about comments but...

      We were integrating some code from a third party once, and one of the developers found code which alloc'ed memory, and if it failed executed:

      printf("Fuck me! No memory left\n");

      exit (1);

      He sent mail to the team asking "Should we change this?", to which our manager immediately replied "Of course, it isn't internationalized".

      Ah, for the fun days programing for a young company with money :(

      1. Anonymous Coward
        Anonymous Coward

        Re: Not about comments but...

        I did once have a customer contact me and ask why he'd gotten the error message "Well, you fucked that one up, didn't you you twit?" Turned out his server environment wasn't configured properly, so a should-never-happen condition...happened. Fortunately, the customer had a sense of humour and I got away with it.

      2. Anonymous Coward

        Re: Not about comments but...

        should be

        fprintf(stderr, "Fuck me! No memory left\n");

        1. Anonymous Coward
          Anonymous Coward

          Re: Not about comments but...

          should be

          fprintf(stderr, "Fuck me! No memory left\n");

          In the kernel?

    2. Nick Kew

      Re: Not about comments but...

      I've used that kind of thing, and seen the errors appear for real an enhancement or two later.

      It anticipates the possibility of future code change, as in a class you intend always to be overridden, but implement stubs for. Or even simpler, this sorta thing:

      enum { foo, bar } x;


      switch (x) {

      case foo: do_something; break;

      case bar: something_else; break;

      default: fputs("BUG: unhandled enum value in ...", stderr);


    3. John Tserkezis

      Re: Not about comments but...

      While testing software at a place I used to work at a million years ago, a windows mode (back in the DOS days) program if run under DOS would result in "This program must be run under windows" or words to that effect.

      Except this one: "This program must be run under windows you dumb fuck" or words to that effect.

      I don't remember if we found out about it first, or the client(s), the programmers probably had a few stern words said to them though.

  15. Buzzword

    Passive-aggressive comments

    In any sufficiently large team, there is usually a snarky comment like "Well, I wouldn't have written it like that, so I've had to insert this hack to make it work. Thanks a bunch."

    That's one of the more polite variants. Team morale is the first casualty.

  16. T. F. M. Reader Silver badge

    Some write only comments, not code

    Years ago I had to port a rather large body of C++ code, with which I was completely unfamiliar, to Linux. At some point I came across a header file that was #included all over the place but contained nothing but a comment. It said, roughly,

    // Since AIX has WIN32 API emulation now we can throw away

    // the whole UNIX branch.

  17. The Real Tony Smith


    INCX ; increment x

    1. This post has been deleted by its author

    2. Mike Tubby

      Re: Assembler.........

      ... and the C version:

      i++; /* increment i */

      1. Aristotles slow and dimwitted horse

        Re: Assembler.........

        And the English version...

        "Please dear chap, can I have another of those lovely 'x' thingies?"

  18. Will Godfrey Silver badge


    // sa schimb

    took a while to work that one out. Done by a coder friend who is sadly no longer with us :(

    1. lucian pop

      Re: C++

      was it before google translate? :)

  19. Julian Bradfield

    XEmacs has lots of vigorous comments, as you would expect from something on which Jamie Zawinski worked. Such as

    /* #### urk urk urk!!! Chuck fix this shit! */

    and then a few hundred lines later

    /* #### Chuck fix this shit or I'm gonna scream! */

    The comments are at least 15 years old, and Chuck (who is still around) still hasn't fixed them.

    (#### is code for "major screwage that should be fixed for the next release")

    There ain't no passive aggression in XEmacs!

  20. Old Handle

    I have a feeling the question posed in this thread has been misinterpreted somehow, but the more I think about it, the less sure I am that I understand it either.

    1. jake Silver badge

      @Old Handle

      IMO, the original was based on the premise that "programmers only know a single language". Which is, for most of us, patently false.

      Thankfully, the thread has evolved into something more enlightening.

      Enjoy the banter, relax, and have a homebrew :-)

  21. This post has been deleted by its author

  22. poopypants

    Old school assembly language programmer

    ; Swap registers R1, R2

    R1 XOR R2

    R2 XOR R1

    R1 XOR R2

    1. This post has been deleted by its author

    2. Nigel 11

      Re: Old school assembly language programmer

      Hardly. Old-school assember newbie who didn't know what a macro or a pseudo-op was.

      You'd code

      SWAP R1,R2

      and the macro or assembler would generate the sequence of XORs if that was the most efficient way to do it on your CPU. If the hardware vendor hadn't written it for you, any self-respecting assembler programmer would have written it for himself.

      I once saw an enormous macro to implement

      SETCONST register, value [,scratch_register]

      which avoided loading a constant from RAM for about a thousand commonly and less commonly used constants on an early instance of what would later become known as a RISC architecture.

  23. Anonymous Coward
    Anonymous Coward

    Not comments, but

    Year 200 is arriving. I was involved in making a VAX VMS 2000 safe.

    But unfortunately nobody (hired in help) could find the files to do the date changes ?

    The reason was (that I sussed) was each file name had an extra space at the end ("do_data_search " et al), so obviously they was written on a a dubious platform then FTP'ed to the box.

    Monkeys or Sheeple?


    1. Mike Tubby

      Re: Not comments, but

      More likely transferred via Kermit with the wrong space/newline conventions .... been there before!

  24. Alistair


    RPGII ? Someone put comments in RPGII code? they musta been fired

    Best one I've seen:

    # Just because security thinks they know what they are talking about, even if we don't agree

    umask 0377

  25. Steve Davies 3 Silver badge

    Assembler programmers

    comment every line.

    how else will anone understand register indirect addressing witth auto increment/decrement?

    Cobol Programmers using punched cards start theit comments at column 73

    Forth Programmers don't comment. Every bit of their code is self describing to other Forth programmers.

    Yes the above comments show my age.

    1. Anonymous Coward
      Anonymous Coward

      Re: Assembler programmers

      "Forth Programmers don't comment. Every bit of their code is self describing to other Forth programmers."

      All kidding aside, I've found Forth programmers the most reliable of documenters, partly due to the old tradition of shadow blocks which practically sucked comments out of you.

  26. Steve Davies 3 Silver badge

    Best comment ever

    was in the Ultrix-32 V4.2 Kernel. Deep down in the Processor specific stuff there was a line

    'I don't know how we can ever get here but if we get here,we are in deep shit.'

    This was followed by a 'Halt'

  27. Will 28

    Cruel coders comment thus

    This still exists in our codebase, I've checked the source control history, and it has not changed since the migration 4 years ago, I still don't know what it is talking about:

    // Note: Important, when changing this remember to

  28. Blane Bramble

    From my own code circa 1992:

    /* I don't know what the f**k this does, but it works */

    1. ian 22

      Coding in the 'zone'

      I've written code like that before. Do you shift gears in your brain into 'machine mode'? I do, and all the world seems to vanish and all that is left is problem space. Some code I then generate seems straightforward but I can't understand it when I try to analyse it. Upon exiting the 'zone' I felt exhausted, much as oracles of ancient times were reported to have been when the god released them from their trance.

      The 'zone' ultimately became a frightening place for me.

  29. Herby

    If you were in the 60's

    C Comments would

    C Have 'C' in column 1.

    C If you needed to elucidate the operator, it would be something like:





    1. Nick Kew

      Re: If you were in the 60's

      The 60s? Wasn't that when IBM thought total world demand would be half a dozen or so computers?

      I was writing FORTRAN in the '80s. And I've seen people from a scientific background still write effectively FORTRAN when writing C++ or ADA.

  30. Mike Banahan

    RIP Dennis Ritchie

    I can't believe that nobody has yet posted Dennis Ritchie's famous comment from the context switch code in the middle of the Version 6 Unix kernel, something which has passed into hacker folklore:


    If the new process paused because is was swapped out,

    set the stack level to the last call to savu(u_ssav).

    This means that the return which is executed immediately after

    the call to aretu actually returns from the last routine which

    did the savu.

    You are not expected to understand this.


  31. Simon Harris


    I'm thinking of writing a process that can load a batch of images in the background.

    The first line will read...

    // This thread is useless without pictures

    1. Sir Runcible Spoon

      Re: Thread-safe?

      // I, for one, welcome our new commenting overlords

  32. bob, mon!

    Hobbit's original netcat code...

    Around 1995 Hobbit wrote "netcat", a useful little telnet/web-broswer substitute. It contained delightful comments, including this:

    /* I really want to strangle the twit who dreamed up all these sockaddr and

    hostent abstractions, and then forced them all to be incompatible with

    each other so you *HAVE* to do all this ridiculous casting back and forth.

    If that wasn't bad enough, all the doc insists on referring to local ports

    and addresses as "names", which makes NO sense down at the bare metal.

    What an absolutely horrid paradigm, and to think of all the people who

    have been wasting significant amounts of time fighting with this stupid

    deliberate obfuscation over the last 10 years... then again, I like

    languages wherein a pointer is a pointer, what you put there is your own

    business, the compiler stays out of your face, and sheep are nervous.

    Maybe that's why my C code reads like assembler half the time... */




    Then there's this little gem:

    /* some systems, notably linux, crap into their select timers on return, so

    we create a expendable copy and give *that* to select. *Fuck* me ... */

    if (timer1)

    memcpy (timer2, timer1, sizeof (struct timeval));

    rr = select (16, ding2, 0, 0, timer2); /* here it is, kiddies */

    if (rr < 0) {

    if (errno != EINTR) { /* might have gotten ^Zed, etc ?*/

    holler ("select fuxored");

    close (fd);

    return (1);


    } /* select fuckup */

    1. Nigel 11

      And Embedded deep in VMS

      Somewhere in the system timer interrupt code, back in the days when you got the source of the entire VMS operating system on Microfiche with every new release ...

      ; Does anybody really know what time it is

      ; Does anybody really care

      ; If so I can't imagine why

      ; We've all got time enough to die

      (which is of course a quote of a lyric by , IIRC, Chicago).

  33. Mike Tubby

    PDP11 Assembler

    MOV -(PC), -(PC) ; go backwards

    aka "014747" ;-)

  34. Anonymous Coward
    Anonymous Coward

    :: double colon, ms dos comment. Dangerous in nests with extensions, but avoids substitution.

    Everyone already had the 2 I was going to post, I'm just too slow :-/

    1. Sir Runcible Spoon

      Cisco IOS (I know, it's isn't programming as such)

      ! Why are we allowing this?

      and Perl

      # This is where I put that code in that I found on the net

  35. John H Woods Silver badge


    "A good Smalltalk method probably only has one comment, which describes what the method does. Everything else should be pretty understandable from reading the code. If it isn't, that's usually the fault of the coders (the reader, the writer or both) rather than the language. Any method big enough to need inline comments is usually too big to be a single method, and should be a considered a candidate for refactoring."

    ^self commentOnly

  36. oldtaku Silver badge

    I quote like 'this' because Python lets me and I'm lazy.

  37. jake Silver badge

    Seen in a five page bit of in-line assembly language, BSD kernel code, K&R C, circa 1985

    ;I don't remember exactly why I wrote this shim, nor what it does

    ; It was late, I had several beers ... you've been there, admit it

    ; But don't change it or everything else breaks!

    It's been in my personal `.fortune` file since I first ran across it :-)

  38. raving angry loony

    Comments? I bloody wish...

    The programmers I've been dealing with don't comment. They even go to the trouble of removing comments that support staff put in to guide them. (because "they aren't required"). All code is self-documenting, and if you want to find out what it does, just read the code. Commits (when they have them - most of the code isn't in a repository) have things like smiley faces or "fixed" as the comment. After all, it will be obvious what they intended for the code to do, as opposed to what it actually does.

    No, I'm not fond of the programmers I've been dealing with lately.

  39. DF118


    'I hate my job

    'I hate my job

    'I hate my job

    'Seriously, what the fuck am I doing here?

  40. SiempreTuna

    I worked with a guy once who never commented code because "it was hard to write, it should be hard to understand".

    His boss went completely the other way: she was converting code from one tool to another and in the middle of the most important section she had a comment "Didn't understand this bit so left it out" - so comments instead of code. What could possibly go wrong ..?

  41. qwertyuiop


    I'm distinctly old-school - I cut lots of COBOL code in the late 70s and early 80s. I'm part of the reason you had all that fun re-writing it in 1999 ;-)

    Two particular memories from having to amend programs others had written:

    1. A long program (about 10,000 lines of code excluding the Data Division) which was generally well commented. The comments were brief, to the point and helpful except for THAT section. This was a chunk of about 1,000 lines of incredibly intricate code that used some of COBOL's more obscure functions in very "creative" ways. It had one single line comment at the very beginning which began with the unforgettable words "This section simply..."

    2. Amending a program that had been amended and added to by three programmers before me in addition to whoever wrote it. Clearly whoever had done one of the amendments had had a bad time with whoever wrote the spec because two of the data items he had defined two were named "NEVER-MIND-WHAT-YOU-MAY-HAVE-HEARD" and "JUST-STICK-TO-THE-BLOODY-SPEC".

    Ahhh... happy days!

    (Beer - 'cos I wrote some of my best code after two-hour boozy lunchtimes!)

  42. Longrod_von_Hugendong

    On a more sensible theme for me...

    We have just taken over a project re-write for a client, and i just got the old source code, all VB - and not one comment in the entire source code - also its the first time i have looked at vb since about 1997... i would like to remind the readers of the tao of programming...

    Thus spake the master programmer:

    ``Though a program be but three lines long, someday it will have to be maintained.''

    and this one is 3 lines long.

    We are converting it to a web based system, but i am still like WTF can you program with *no* comments at all.

    Also - please refer to :D

  43. Erebus

    Comments slow my code down

    I once worked with a smart arse whose rationale for not putting any comments in any code was that they would slow down execution of his apps. Now, just to be clear, we're not talking about interpreted or JIT-compiled code here. Later after wearing him down some, his argument reduced to the comments slowing down interpreted code, so we organised a little test in the office with HEAVILY commented vs uncommented version of a script of his, and ran benchmarks on them - we were unable to measure any difference between them...

    1. Erebus

      Re: Comments slow my code down - when comments become code

      Oh, and the "rule" for a long time at another place I briefly worked was that comments had to have jump instructions around them - to avoid programs being slowed when "processing" them! Even batch files were not spared - every comment had to be preceded by a GOTO statement jumping to a named label:

      @Echo off

      GOTO SkipREM1

      REM ***********************

      REM * This is a comment

      REM ***********************


  44. DJV Silver badge

    Most informative comment

    The "most informative" comment I ever saw was on a non-trivial piece of Perl. Most of the code was undecipherable in the first place, but the most complex part was blessed with a single comment (the only one in the whole script) that simply read:

    # This is a skanky hack!

  45. breakfast Silver badge

    Bracketing out

    Lets not forget lisp comments:

    ()((()()))()))())))()()()))))()))))((()()))()))) ; (()()))()))()()))

  46. Anonymous Coward
    Anonymous Coward


    We started off with quite a well-commented application. Since we offshored, our offshore friends' favourite trick is when we need something that's similar but not quite the same as a bit of existing code (e.g. a stored procedure), they copy and paste, and modify everything...except the comments, which remain identical to where they copied it from and tell you nothing about the new code. This is now all over the codebase, every so often if I see one I try to fix it, but it's a losing battle...

    1. DJ 2

      Re: irrelevant

      Our Indian offshore developed application had this comment.

      private float btwidth; // 列与打印页面的宽度比例

      And google translates says "And print out the page width ratio"

      which is just a WTF in it self.

  47. TheOtherHobbes

    Haskell comments itself because:

    1. It's cleverer than you are.

    2. Once you've told it everything you know, the rest is obvious.

  48. Caff

    infinite loop

    PERFORM UNTIL 1 = 2 *> Infinte Loop until end of GDG

    It makes sense to create in the context of the programm... but an infinite loop on purpose. I was scratching my head for a while and then thought.. well it works I'll leave it alone.

    1. JulianB

      Re: infinite loop

      "DO FOREVER" is a completely standard REXX command...

  49. Anonymous Coward
    Anonymous Coward


    A customer agreed to pay (a small fortune) to have access to the source code at the end of a managed service period and so it was sent through to them with a big fat ribbon on top. A long term problem that had never been fixed properly despite seven years of work was reviewed by them and they found a comment with a date five years earlier saying "I have no fucking idea what this portion of code does".

    So, how about a slice of humble pie that comes direct from the oven of shame set at gas mark 'egg on your face'? And perhaps a sizable discount on that code?

  50. Andy A

    Remember ICL?

    One of the comments in the source for the 2903/4 & ME29 operating systems read:


  51. Andy A

    More ICL

    The microcode listing for the 2960 reputedly had a page mostly full of asterisks, in the middle of which was the message:


    1. Stiggy


      // TODO

      throw new NotImplementedException("Hopefully this will never get called...");

      1. kerrymanam

        Re: C#

        How to thrrow exception from c# c# exceptions


  52. halfmanhalfbiscuit

    Once upon a long ago I worked on a DEC PDP 11/44. I was part of a COBOL team but we also had another team doing work with a "high-level" BASIC provided by DEC (BASIC+2 or summat). Comments were required even for the manky BASIC, and I was reviewing something after one guy left the project. All his code was in handy chunks of 15-20 lines with nearly as many comment lines between...


    All his comments were verses from a Thousand and One Arabian Nights...

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon