1

I'm a software developer, and as such I often use an IDE to fulfill my goals. For those who don't know:

An integrated development environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development.

Sometimes while programming I find myself making certain errors. One of them is creating a variable (A name that holds a certain value) that is never used. An IDE can show a certain message and underline the error for me so that I notice it quickly and fix it.

I have been using multiple IDE's that have shown me the error shown above, but I just noticed something. In one IDE, the message is shown as "Unused expression", while the other says "Useless expression".

Which IDE is saying it right? Is it supposed to be "Useless" or "Unused"?

2

I think that the distinction between the words is pretty clear.

Unused

Not being, or never having been, used

Useless

Not fulfilling or not expected to achieve the intended purpose or desired outcome

Now, unless the latter IDE's name is HAL 9000 and/or it's passing judgement on the quality of your coding, I think it's safe to say that the IDE will have not the first clue of your "intended purpose or desired outcome", or indeed whether you have finished writing your code. For all it knows (which is nothing, since it's not sentient (one may hope, or the Terminator movies will become documentaries)), you may have yet to add code which will use that variable.

Consequently the IDEs which report that the variable is UNUSED, and leave the decision about whether to do anything and if so what to do to you, would be the ones that are correct. And I suspect that that will be most of them.

The other one may well have been written by someone whose previous screen display read something along the lines of "all your bases are belong to us".

  • Why did you quote that particular definition of useless? Why not this one: of no use; not serving the purpose or any purpose (dictionary.com). This answer quotes an irrelevant definition, and then speculates that the IDE is wrong; meanwhile the correct answer was already posted, twice. Why was this accepted? – Vladimir Kornea Jul 16 '15 at 9:11
  • 2
    Note that an unused variable can be useful. For example, the value can be printed using a debugger. So saying it is "useless" is incorrect. – Craig S. Anderson Jul 16 '15 at 9:11
  • @vladkornea :Because I'd rather take the OED's idea of "relevance" over yours. Incidentally, the reason that your post apparently got in a whopping 5 minutes ahead of mine (not that yours was visible at the time that I posted; I can't type AND get citations instantaneously) is that you didn't even bother to take the time to quote ANY definition, but rather relied on your own opinion of what the words meant. Maybe THAT was why it was accepted? If you want to get hissy because you were denied what you apparently think is your rightful 15 points then get a sense of perspective. – Alan K Jul 16 '15 at 9:32
  • @AlanK You are extremely rude to say to me that I "get hissy". You don't know me, and have no justification for speculating about my manner or psychology. This answer is wrong. You quoted a definition, yes, but you also ignored the existence of other definitions, and speculatively arrived at the incorrect answer. This isn't about links vs no links. This answer is wrong. – Vladimir Kornea Jul 16 '15 at 10:10
  • Hi Vlad, You are extremely rude to call someone out for quoting an "irrelevant" definition (in your not so humble opinion) from a university dictionary of hundreds of years standing as opposed to your "SomeRandomWebsite.com", not that any of the definitions that you've cited are in fact much different to the OED one. So if I'm going to be taking etiquette lessons, it certainly won't be from you. And I regard YOUR answer as being wrong. Unlike you, I have based this on reasons (as per my comment to your updated post), not "because I say so" which seems to be your (again, rude) approach. – Alan K Jul 16 '15 at 10:18
1

Both are correct. The difference between that two is that something "useless" has no use whatsoever; something that is "unused" could have a use, but is not being used currently. In a software system, an unused expression is a useless expression, so you can say either one. "Useless" is a stronger way of saying it.

Update: References supporting my definitions:

Useless

Dictionary.com: of no use; not serving the purpose or any purpose; of no practical good

Merriam-Webster: not at all useful; having or being of no use

Unused

Dictionary.com: not used; not put to use

Merriam-Webster: not being used

  • See my comment in response to yours. – Alan K Jul 16 '15 at 9:32
  • I still disagree that the definitions (now that you've supplied some) support your stance. As Craig Anderson stated, an unused variable can still be useful and therefore not "useless" by the definitions above. And as I stated, it may be the case that the coder has yet to use the variables but may have added them ahead of writing the code to use them. I for one do this in that I plan out the variables that I need and declare them first. This is a useful cross-check that all of the code has been written. Again the variables are "unused" but not "useless" by any definition cited. – Alan K Jul 16 '15 at 10:05
  • Right back at you, Vlad. – Alan K Jul 16 '15 at 10:18
0

They're both right. If you've defined a variable that's never used, then by definition, it's unused. If you don't use it, then it can have no utility in the program, so it's also useless.

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.