26

When a piece of code is commented we say just that, it's "commented out". But when it's not commented out, what is that?

Uncommented isn't quite the same. Active? It's definitely not commented in.

What's the best way to refer to the act of de-commenting out code?

3
  • 1
    If there is a more annoying and confusing practice than checking-in commented-out "code" (comments that bear a lexical resemblance to code), I'm not aware of it. Jun 14, 2009 at 3:12
  • @Doug McClean: More annoying and confusing == coming back 2 years later and trying to figure out what they were for. Aug 25, 2009 at 5:13
  • I think we'll have to come up with creative suggestions like unoutcomment, reincomment, anticomment or awaycomment
    – Manu
    Dec 10, 2009 at 12:35

16 Answers 16

30

Uncommented is the most common word for that.

1
  • 2
    +1 Also, in popular IDE's the verbs for commenting out and the opposite, are usually given as "Comment" and "Uncomment", so add a past tense to these and you get "commented" and "uncommented".
    – maxwellb
    Jun 13, 2009 at 22:08
26

I call code which isn't "commented out" simply "code"

4
  • 1
    Sure, but code with comments is not the same thing as "commented-out-code". In my view the "default" state is "code" -- after commenting it out it becomes "commented-out-code"
    – DarkSquid
    Jun 13, 2009 at 22:29
  • I agree, it's code. Code does not include comments. That's why you call code with comments "Commented code". Because the Comments and the code are different things. Code generates instructions the computer can run, comments cannot. Jun 13, 2009 at 22:40
  • 3
    Unhelpful answer. Nov 9, 2017 at 15:15
  • I concur, this answer might be smart but is not helpful. I'd like to tell people that a specific line of code is commented (out) for a given reason but of course they are free to uncomment it locally for test purposes. I surely won't tell anyone to please not check it in "as code".
    – bfx
    May 24, 2019 at 13:09
6

Visual Studio has a function called "Comment out the selected lines".

The opposite function is called "Uncomment the selected lines". I use the term "uncommented."

1
  • 1
    Best answer since it includes a source :) Nov 9, 2017 at 15:18
4

A couple possibilities:

  • Live code
  • Legacy code
1
  • 1
    +1 I was going to try to use live code it sounds natural to me. Although I'm surprised it is in one list with Legacy code - what?! Uncommented is live, but how does that imply legacy? Apart from "everything is legacy once it's written". ;) Sorry maybe I'm just not a native speaker.
    – n611x007
    Dec 20, 2012 at 4:52
3

I wish it were "uncommented in."


I use "revived" or "restored" for code that used to be commented out, but no longer is. I use "live" or "uncommented" for code that's intended to be compiled or executed.

3

If it was once commented out in the past, then by uncommenting it it will become

  • Decommented.

(You can recomment it if you want but I won't recommand that..)

If it was never ever commented out, it's just

  • code.

These are, to me now, the several different (*) states a Live code can have. (Or maybe it's just yoda english.)


*: implicit potential meta- [add your latin-born term here :P].

1
  • And by the way, decommented seems to share some funny common ancestry with dementors. While code, waiting to be chosen for being commented out, shares that ancestry with the cannabis-cannibalism of 'candidate-wannabeness' oh.. well.. never mind.
    – n611x007
    Dec 20, 2012 at 5:06
2

It's just a piece of un-out-commented, un-disabled, un-erased, un-inactivated, un-unused, un-deprecated, un-obsolete, un-rewritten, un-archived code.

Or, in layman's terms, code.

2

Think of an editorial document. Its kind of like saying "what is the un-deleted writing called?" Just, the writing.

1

Although it is widely used to refer to 'live' code, 'Uncommented code' is an ambiguous term. It could refer to code that was once commented out, but has been edited to allow it to be run, or it could refer to code that has no descriptive comments.

0

I call commented out code...poor code. If it is to be commented out then just toss it all together. Your version control system should keep track of the various states of your previous work. Rather than commenting it out for others to figure out why it was commented out later doesn't seem to be a good coding practice!

1
  • 1
    To an extent, I agree with you with you, the exception that comes to mind though is commenting out things whilst debugging. Jun 13, 2009 at 22:42
0

Seeing how many disparate answers exist for this question, there are a few things you should do.

  1. Pick a term and stick with it.

    Consistency is most important. It's okay if it's not the best one ever, and you can change your choice if a more obvious term appears in the distant future.

  2. Explicitly describe that term to your teammates.

    Don't just say, "it means uncommented, or whatever you call it." Don't just say, "it's the opposite of commented." Tell them that it means code that was previously commented out, and has now had its commenting syntax removed. Tell them that this code is now active and will execute when called. Never assume that your team is smart enough to "just get it" just because they nod when you use the term.

As a subjective answer, I use the term uncommented. It's a bad name for the behavior, but at least it's mildly intuitive. It beats nonsense like unhashed for languages that use the # character for comments.

0

I honestly do say "commented in". In phrases like "well, it works with that line commented out, so let's comment it back in and re-run the test". "Uncomment" would be more correct, but sounds clunkier. I wouldn't use that expression in formal writing, though, just when talking to my pair.

0

During a debugging session, I often comment and uncomment lines of code.

From a purely semantic (and yes, anally pedantic) perspective, it's the action that's described by the phrase, not the code.

"Commented Out" is a verb describing the action whereby a statement was turned into a comment to remove it from the code that's acted upon by the language's parser.

Code having been subjected to the opposite action, that of taking a comment and turning it into a statement to include it in the code that the language's parser acts upon, would be "Statemented In". But of course that's ridiculous.

That said, I agree with Andrew that outside of a transient debugging session, before it's committed, code should be removed if it's not used and not left around in comments to confuse things.

1
  • Except if it is in a config file. Here disabled options are often commented out and left in on purpose, so that the file is self-documenting.
    – Dakkaron
    Jul 8, 2021 at 16:08
0

The problem is with the term "commented out". It's an abuse of the comment feature of most languages. In C/C++ you should use the preprocessor to conditionally compile your code, perhaps like the following:

#if 0
...
... here is the code that is not in the build
..
#endif

...
... here is the code that is in the build
...

I recall a coding standard in a place I used to work at used "#ifdef NOT_DEF" and a few other symbols in place of "#if 0" to add some semantics to the "commented out" block.

The terms used under this scheme were "included" and "excluded" code, though "included" was usually assumed when talking generally about "the code".

Of course, not all modern languages have such a preprocessing feature, so you're back to abusing the comment feature.

2
  • I try to avoid using conditional compilation, since you can introduce errors since the code being compiled isn't the same. A better bet is to define a macro at compile time that you're debugging (i.e.: gcc -DDEBUG=1 for debug, gcc -DDEBUG=0 for release), and wrapping debug code with if(DEBUG). This way you always compile the entire codebase, but you don't use it if its in the release build. The only issue is that it can grow the release executable since all the debug stuff is still there. Jun 14, 2009 at 4:17
  • "-DDEBUG=1" on the command line is equivalent to a "#define DEBUG 1" at a global scope. It's still conditional compilation! In your case the code sections inside a if(DEBUG) block will not be compiled in release builds. Jun 15, 2009 at 10:16
0

I ended up going with commented code being code under comment and normal code being code not under comment. The action being take code from under comment or bring out from under comment.

0

We call it 'unremd'. You won't find it in the dictionary but it is the opposite of REM(d) and most importantly has fewer syllables...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.