The asker posts a false statement: "This code runs in time complexity X." Should they be corrected in an answer or in an edit? ... or maybe a comment?

More generic:
The asker posts a false statement: "This code even handles corner cases like X." Answer, edit or comment? Why?

  • \$\begingroup\$ Is it 100% false, or is it false because it works in some scenarios (which the asker may have tested) but not in others which you noticed but the asker may not have tested? \$\endgroup\$
    – nhgrif
    Aug 7, 2014 at 16:56
  • \$\begingroup\$ Lets go with multiple cases: 100% false, in which they make an absolute statement ("This code is thread-safe", but features no sync or lock, OR "This code runs in time complexity X for worst case", and that's just wrong), and slightly false ("This code implements standard X correctly" and they've forgotten to support the default value for parameter Y) \$\endgroup\$
    – Pimgd
    Aug 7, 2014 at 17:33

1 Answer 1


It Depends

My favorite answer to these questions. ;)

No matter the scenario, I don't recommend editing the question. The sort of statement you're talking about is part of the definition of "as intended" in the phrase "works as intended". By editing the statement, you're editing the users definition of the intended functionality of the code.

So, what should we do, if not edit?

Given my claim that this sort of statement helps define the "as intended" part of "works as intended", and keeping in mind that CodeReview questions have the requirement of working as intended, to the best knowledge of the asker, let's consider what we should do.

If the given code doesn't do what the statement claims in any scenario, then the question fails the "works as intended to the best of my knowledge" because if it works in NO scenarios, we fail the "best of my knowledge" part of that rule. If you don't test it at least once, you're not even close to being able to claim the best of your knowledge.

If the given code works in a lot of the ways the statement claims, but fails under certain conditions that you noticed... then ask yourself. Am I willing to accept these conditions as outside the realm of "best of (the asker's) knowledge"? If you can accept the discrepancy as small bugs that may have be missed in cursory testing, then fix the statement in an answer. But I'd argue fix the statement by changing the code to make the claim true--not by answering that the statement should instead by this to match the existing code. This of course may not always be possible--but when possible, strive for this.

Otherwise, if the statement is making claims outside the realm of "works as intended to the best of my knowledge", then the appropriate action may be to close the question. The user will either need to fix his code or his definition of the intention of his code before the question is on-topic.

  • 1
    \$\begingroup\$ what about non-functional, non-correctness statements about the code (time complexity)? \$\endgroup\$
    – Pimgd
    Aug 7, 2014 at 18:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .