What a comment!



  • We've bumped into this while skimming through one of our software's modules code yesterday:

    /* _COMENTARIO_ INICIO */
    #if 0
                               ESTA DESCARTANDO O NOME DA POSICAO!?!?!?
    #endif
    /* _COMENTARIO_ FINAL */

    If you don't speak Portuguese (that's what it is), the regular leading and trailling comments read something like, "comment begin" and "comment end", respectively. The disabled part, or the comment itself, is neither helpful nor pertinent to the context of the code, it's just random ranting about some decision made.

    Even though I can understand the benefit of using that to unplug comment entwined chunks of code (and I reckon the structure itself was originally used as such); what strikes me as odd and WTFable is that, not only was it kept even after the code was gone (if there was any to begin with), but it was actually (ab)used/molested as seen, instead of replaced by some regular comment. ...or nothing at all while we're at it!



  • Well, it got your attention, didn't it? :)



  •  If I'm not mistaken, the code block isn't actually commented out either.  It's a good thing the compiler if would never be true.  The compiler can barely understand our own code let alone yelling in Portuguese.



  • @smbarbour said:

     If I'm not mistaken, the code block isn't actually commented out either.  It's a good thing the compiler if would never be true.  The compiler can barely understand our own code let alone yelling in Portuguese.

    Rest assured the literal 0 (zero) in the compiler if will never be true.

    #if 0 is usually considered a form of comment. It's normally used for commenting out code, because it can contain any other kinds of comments including more #if 0 comments, which isn't the case for /* */ comments. Most IDEs and highlighting editors recognize it and highlight it as comment.


Log in to reply