I think I may already know the answer to this, but am interested in opinion on course of action that is best to take.

Recently a question was posted regarding an analysis of a potential memory leak in a simple C++ function pair. The question was essentially "Will this leak memory" ? The question should have been "Will this leak memory if I ever get it to compile and run" since it would not. (pushing an int* into a std::vector ergo. not a happy gcc).

I answered both the question (with or without the fixed code, it would leak memory) and followed by pointing out that the code was broken anyway and you can't be pushing int* items into a std::vector. My answer was up-voted twice. Shortly thereafter the OP fixed the code in the question, and shortly after that the down-votes rolled in since the answer no longer matched the question (all of them without justification comments for why, naturally).

Is there anything that an answerer can/should do at this point besides taking their lumps and realizing that some people will never bother to take the time to see the edit history of a question? Furthermore, is it the answerer's responsibility to ensure that, for the lifetime the OP sees to service it, changes in their question should trigger a change in your answer or face the wrath of passer's by? Is it best to just delete the answer (something we have a daily limit on doing, so it may be there awhile)? What has your experience been in the past? I ended up just deleting the answer, but I'm hoping this is an exception and not a rule.

Thanks for taking the time to listen. I hope you all have a great day.

  • 2
    You'll have to trust me Marc. Yannis won the flip. Both great insight. I wish I could mark both. Thank you.
    – WhozCraig
    Oct 9, 2012 at 8:44
  • 2
    And here's a fairly recent example of a mod taking care of a similar situation.
    – yannis
    Oct 9, 2012 at 8:58

2 Answers 2


If the question was changed significantly, you could roll back the change and post a comment asking the OP to post another question if they want to ask something different. If, however, they don't accept that, don't antagonize them, you can (in order of preference):

  1. Update your answer to match the current version of the question, or
  2. Delete your answer, or
  3. Flag the question for moderation attention and clearly explain that the OP significantly changed it, and now is being silly about it.

But if the change was minor, just update your answer.

  • 2
    That makes sense. It wasn't so much the question as it was the code in it. by modifying that, the comments in the answer became meaningless, and thus undesirable. I don't think it deserved a rollback, but it was a cause for change of opinion that was not present when asked. no matter. #2 seems the best alternative for such a situation. thnks.
    – WhozCraig
    Oct 9, 2012 at 8:38

It is a tricky one; if the original question had merit and could reasonably be answered - but the OP has essentially asked a second (different) question over the top of the first (it has happened), then I would be quite supportive of reverting the edit, and requesting the OP to ask that as a new question.

However, if the original question was lacking necessary information, and was refined by the edit, then I would advise: just delete the answer that is now out of date, or, add a comment in your question (perhaps linking to the revision history) that acknowledges that the answer no longer applies to the now edited question, and clarify exactly what scenario your answer does relate to.

In the case of incomplete questions, it is also worth asking for clarification (via comments) before leaping in, but: I also appreciate that a lot of the time people can read between the lines correctly and provide a good and accurate answer to a very incomplete question, via psychic debugging - so I also won't say it is wrong to jump in an provide an answer to an incomplete question. It may be worth clarifying, via a preamble like "Your question is unclear, but assuming that you mean {some context}, then: {your answer}".

  • 2
    Both your and Yannis answers seem to tell me I did the right thing by the delete. The question wasn't changed (am I leaking memory), the code did, and therefore comments in the answer were no longer with merit to the reviewer that sees both. You both have put up terrific thought for answers, and I truly appreciate it. Care to flip a coin to see who gets the check ? =)
    – WhozCraig
    Oct 9, 2012 at 8:41

You must log in to answer this question.

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