81

Yesterday, I answered a question about C++ input with an answer that described the very common problem of mixing cin >> and getline in the same program and the confusion that ensues.

Three hours later, I found another question which was a result of exactly the same problem and had the same answer. So I copied my answer from the previous question.

Moderator ChrisF just deleted my first answer with a remark about closing as a duplicate:

If you think you've found a duplicate question please vote to close it rather than posting identical answers. – ChrisF♦ 15 mins ago

However, these questions were asked in an entirely different way - I do not believe that they are duplicates. (Believe me, I'm quite happy to close questions as duplicate when appropriate.)

I have to assume that my answer was flagged by some automated duplicate answer checker, as it seems pretty unlikely that ChrisF would notice that otherwise.

What would have been the correct course of action here? Is it really forbidden to post the same answer to different questions? Should I have reworded the answer to use different words, even though it needed to say the same thing? Would marking these questions as duplicates really have helped the OPs?

7
  • Well, don't we judge duplicates about having appropriate answers, despite questions and their context appear to be different? What counts, is the answer solves the problem being asked IMHO. If I'm marking for duplicates that are not clear from the given context at a 1st glance, I usually leave a clarifying comment. Commented May 4, 2015 at 22:26
  • 22
    I'll let ChrisF respond, but typically if you can copy and paste the exact same content to multiple questions it does make it seem that the questions are duplicates. Answers should be specific to each individual post so they should be worded as such. We don't like verbatim copies of answers on multiple questions.
    – Taryn Mod
    Commented May 4, 2015 at 22:28
  • I would provide the link of answer as comment or would write the answer differently and link that answer for more details. Commented May 5, 2015 at 1:24
  • 2
    Isn't it more appropriate to VTC the question as a duplicate rather than deleting the answer? At least make a comment for the person asking the question that they can find the answer elsewhere.
    – DavidG
    Commented May 5, 2015 at 14:22
  • 1
    Possible duplicates? meta.stackoverflow.com/q/270841/372643 meta.stackoverflow.com/q/266244/372643
    – Bruno
    Commented May 7, 2015 at 18:21
  • possible duplicate? "Different questions with the same answer - best practice?" meta.stackoverflow.com/questions/365210/…
    – David Cary
    Commented Dec 29, 2019 at 16:57
  • In this question, is the highest scored answer considered canonical, or is it up to user discretion? Commented Jul 20, 2023 at 21:33

12 Answers 12

94

No.

The Reductio ad absurdum is (A maths example):

Q: What is 2*13?
A: 26

Q: What is the only integer bounded by a square and a cube?
A: 26

Neither of these are good answers, as they don't explain their method, but they are both correct.


A less absurd example would be questions about Matlab's printf and C's printf which are (at least very close to) identical in usage and syntax. Thus potentially answers could be identical. But the questions would be different. Anyone looking for a Matlab answer is not expected to know that they should be looking at questions tagged C. And potentially other answers (that are not identical) may be posted that suggest a C only or a Matlab only approach to the questions posted.

Thus distinct questions with some identical answers are not identical questions, and thus are not duplicates.

10
  • 45
    I think you should have stopped after the "No.", and go about and close a few questions as duplicate of this question here :-) Commented May 5, 2015 at 14:25
  • 7
    I love this answer. It probably doesn't meet the Stack Exchange guidelines for what constitutes a good answer, but I think it makes an important point, and makes it quite clearly. For me, I also like that the second example question happens to be phrased incredibly poorly (imprecisely). You've kind of thrown in the secondary message: "Don't forget to scrutinize the questions!". Even though questions with the same answer are not necessarily duplicates of each other, they might still need improvement.
    – John Y
    Commented May 5, 2015 at 14:34
  • 29
    I think this is hiding the issue. 26 is a bad answer in both cases. Extend either to good answers, and neither answer becomes an answer to the other. If an identical answer is a good answer to both, then the questions should be treated as duplicates as far as SO is concerned. Commented May 5, 2015 at 14:41
  • 2
    @Yakk I kind of agree with you, or at least see where you are coming from. (This answer was a off-hand kinda comment, I didn't expect it to get many upvotes). Interestingly for both of those questions, a good answer requires a considerable amount of deepish pure mathematics. There are other examples though that are nontrivial. I can imagine explaining certain concepts for two different programming languages, such as printf for matlab, and printf for C being identical and good, but those are totally different questions. Commented May 5, 2015 at 14:47
  • 4
    @ShiDoiSi: twitter.com/balpha/status/215761249730957312
    – BoltClock Mod
    Commented May 5, 2015 at 14:56
  • 1
    I posted this same response as a comment to an answer at meta.stackoverflow.com/questions/266244/…. To quote myself: "What is 1 + 1? 2. What is 1 * 2? 2. Guess that's a duplicate question."
    – teynon
    Commented May 6, 2015 at 18:07
  • 3
    Yes, Frege's Sinn und Bedeutung is interesting for philosophy of language and philosophy of mind, but it's not relevant here. Something with no more content than a proper noun is not a good StackOverflow answer.
    – abarnert
    Commented May 7, 2015 at 0:38
  • 7
    There's a difference between asking two different questions and asking a question two different ways
    – random
    Commented May 7, 2015 at 18:52
  • 3
    Lyndon is exactly right. Same answer does not imply same question. Attacking his example is silly. The argument is sound. Commented Oct 16, 2018 at 17:45
  • @Yakk-AdamNevraumont I think that's a good point. What irks me is that questions get marked as duplicates due to "bad" answers. Commented Mar 19 at 22:22
29

If you can post the same answer on two separate questions it's a good indication that they are identical questions.

If they're not then the answers should be tailored to the specifics of each question rather than just pasting the same text into both answer boxes. If nothing else it shows a degree of disrespect to the second questioner.

14
  • 56
    It might be a "good indication" of a duplicate, but it is far from a certainty. I object to having my answer unilaterally deleted without recourse, just because somebody else had a problem that happened to be the same root cause, and I happened to answer that other question too. Commented May 4, 2015 at 22:37
  • 4
    @GregHewgill - in that case make the delete answer unique and flag it for undeletion.
    – ChrisF Mod
    Commented May 4, 2015 at 22:38
  • 4
    The "undelete" option is unavailable to me, since I did not delete the answer in the first place. Commented May 4, 2015 at 22:39
  • 5
    @GregHewgill - that's why I said "flag it", a moderator will have to undelete it.
    – ChrisF Mod
    Commented May 4, 2015 at 22:40
  • @GregHewgill You'll want to make the answer "unique", then use an other flag requesting a moderator to undelete it.
    – Taryn Mod
    Commented May 4, 2015 at 22:40
  • 2
    Oh, sorry I misunderstood. I'll try that. Commented May 4, 2015 at 22:41
  • 1
    @GregHewgill I handled your flag and undeleted your updated answer.
    – Taryn Mod
    Commented May 5, 2015 at 17:00
  • 7
    I would add that identical answer covering questions that look different may sometimes indicate need for a canonical Q&A to cover them all
    – gnat
    Commented May 6, 2015 at 11:22
  • 1
    ChrisF- you clearly messed up, you could be more diplomatic about it- thats what people expect from mods here. Commented May 6, 2015 at 15:50
  • 7
    @jedrus07 - How do you think I messed up? Is it because Greg is a high rep user? I can assure you I treated him the same as I would a lower rep user. In fact, I hesitated before deleting as I thought he knew how Stack Overflow operated.
    – ChrisF Mod
    Commented May 6, 2015 at 15:54
  • 5
    There's a hidden cost to maintaining duplicated content too, which is another reason it's almost always wrong to just copy and paste content around: if there's a typo/presentation issue that needs correcting in one then it needs correcting in both which is unlikely to be spotted at any point in the future. It's like branching with no source control system in place! Commented May 6, 2015 at 20:09
  • 10
    Sorry ChrisF if I sounded too antagonistic. My point was- 'If you can post the same answer on two separate questions it's a good indication that they are identical questions.' is just not ok. Plenty of problems are solved by the same answer- 'restart the server' or 'restore db backup- only solution'. I think the questions should be judged without answers. Commented May 7, 2015 at 12:42
  • 1
    @jedrus07 I have to disagree with you. If you can post the same code to make two different questions work then the underlying mechanics of the two separate post are the same. Because of that it should be a duplicate. Commented May 7, 2015 at 18:12
  • 6
    @NathanOliver, but that certainly doesn't mean that the question is the same. Answers are there to address the cause of the problem. Depending on the environment, the same root cause can have distinct effects, and thus lead to different questions.
    – Bruno
    Commented May 7, 2015 at 18:26
15

The other answers are quite good and have covered a lot of bases here, but I want to highlight that voting to close as duplicate doesn't always imply the asker was in the wrong. The URL to the duplicate question will still exist, and it is still searchable in Google. So the question still has value, even though it is a duplicate. It helps a person find the correct answer through a different set of search terms. That is one reason it is the recommended course of action.

6
  • As far as I know, duplicate questions may still have a valid URL, but I'm not sure they'll still be indexed.
    – Bruno
    Commented May 7, 2015 at 18:27
  • 1
    I find them through Google searches from time to time. Commented May 7, 2015 at 19:38
  • 1
    My Google searches seem to prefer the questions that were closed as duplicates, typically requiring an extra link to get to the "original" question. Commented May 7, 2015 at 19:41
  • @AdrianMcCarthy If that were true, how could you possibly tell? When you land on a question closed as a duplicate, you see it, but when you land on a question that other questions have been closed as a duplicate of, there's no immediate clue that this is the case - so how could you even start to gauge the frequency of the two scenarios, unless you literally land on a dupe >50% of the time?
    – Mark Amery
    Commented May 6, 2018 at 14:04
  • OK, "prefer" was probably the wrong verb. It happens very frequently, which confirms that they are routinely indexed. Commented May 7, 2018 at 4:02
  • I disagree with you because ... and it is important for me ... a duplicate question (because an answer is duplicate) is closed and user that works hard on StackOverflow has no more the possibility to select WHERE he can add a new answer. A moderator has selected for him where to put the new answer. Sorry, but this is not the StackOverflow Spirit where question and answer can be voted UP and DOWN but not CLOSURE of duplicate. This is a very big problem.
    – schlebe
    Commented Jan 8, 2020 at 12:35
12

I believe the sentiment is, "If the question can be answered from a verbatim quote from another question, then it is logically a duplicate of that question."

It seems that you've encountered one of those scenarios in duplicates which weirds me out a bit. You have two questions which could stand on their own but have a very similar answer to each other. The mantra has long been to close questions like this anyway, but I suppose this is where one who truly believes that the content isn't a duplicate should step in and edit the question so that they're dissimilar.

(It's also a bit of a faux pas to verbatim copy your answer in. That's probably what warranted the moderator attention.)

4
  • 1
    Edit the question? But both users had the very same problem, i.e. both of them mixed cin and gets. I don't think this example is a weird scenario.
    – Alex
    Commented May 5, 2015 at 15:23
  • 1
    It's not that the scenario is weird - it's actually rather common. It's that the resolution to the scenario (at least at first) weirds me out.
    – Makoto
    Commented May 5, 2015 at 15:25
  • 3
    I've seen this many times where, for example, the solution is installing a toolkit that solves a huge array of problems (virtualbox-guess additions anyone?), yet the problems themselves have no relation between them.
    – Braiam
    Commented May 5, 2015 at 16:25
  • VBox Guest additions (and toolkits in general) are a great example!
    – Alex
    Commented May 6, 2015 at 6:43
8

I don't think those questions are duplicates at all, and the same answer certainly does not imply that the questions should be closed as duplicates.

That said, I believe your copy paste content was not the proper way to answer the second question. While it was a nitpick on his code, it was not actually the "root cause". The other answer notes the issue with not using a reference in order to retain changed values. I think you should have added this information into the answer.

Many questions are riddled with questionable implementations, and simply copy pasting answers to each situation where there was a questionable implementation with disregard for the current issue the OP is facing doesn't seem helpful.

In general, copy pasting answers is bad practice, and specifically in this instance it didn't seem to solve the OP's problem.

3

With anything like duplicate, there are always going to be equivalence classes. Things in an equivalence class are not exactly the same, but are the same as far as we care to measure: we on purpose neglect the differences that are not part of what we care about.

The question becomes, what is the right question measure for a Q&A site?

If your answer was a good one, and it was identical in the two cases, then yes the questions are duplicates of each other.

Naturally we cannot use "exact same text" as our measure of equality. The sensible measure for equality on questions on a Q&A site focused on good answers is "would the same answer be a good answer to both questions?".

The fact that the question was asked differently is less important than the underlying problem is the same. Closing as duplicate doesn't mean "you didn't do the research you should have": that is what downvoting is for. Closing as duplicate means "I found a top-notch answer to your problem over here", and/or "it would be better if any answer to this problem was also linked to this other problem, which is older, as a good answer to either is an answer to both".

If you posted an identical answer, clearly you think a good answer to either is an answer to both. If your answers had the same core, but a long description of how you broke their problem down to reach that same core answer, then there is more room for discussion of "are these questions duplicates", as a good answer to each includes a different break down of the problem into digestible solvable chunks.

In any case, that is how I try to wield my Mjölnir. And it seems to work well: people whose questions are closed get an answer, so they don't need more answers directly to their question, and people searching now have more ways to find an answer (different problem statements with the same core solution).

1
  • 9
    Neither questions nor answers form an equivalence relation. It is entirely possible for two questions about different problems to each be solvable in more than one way, and for each problem's "optimal" solution to be totally unusable on the other, but for there to also exist a solution which would be usable for both problems.
    – supercat
    Commented May 5, 2015 at 14:55
3

I personally think that just as a question can have more than one answer, an answer can have more than one question:

just like: these questions:

question 1

question 2

with another account i answerd two questions that had a very different problem but with a few simple standard solutions. I could answer both in a good way.

Therefor I think that for closing a question we should not be looking at the answers given of answers that could be given rather than the question itself.

Also: a user which asks a question can see if his question is a duplicate but he cannot see if the nswers given will be a duplicate when he posts his question.

1

If answer A covers question B fully and clearly, without making the reader hunt through implications and footnotes.... "duplicate" may be the wrong word, but "you flobboxed the giblets; see (A) for a really good explanation" may well be the best possible answer for both the querant and SE.

-1

Some questions leads to the same answer, no doubt about it.

My general solution would be, if possible, to try to explain how the two cases lead to the same answer, and then linking to the other answer. That way both cases are lead to the same answer.

-2

Well, you said yourself that both questions arose from the same problem (which is true, I checked them), so I'd say flagging the 2nd one as duplicate would be just fine. This is not one of those special cases like SE505 and Oxinabox mentioned where two entirely different questions lead to the same answer (though I like those examples :-) ).

So, if it's the same problem, imho it's appropriate to flag the 2nd one as duplicate.

4
  • 7
    Disagree - just because the technical problem is the same does not mean that the question problem is. Questions are quite often about mapping evidence back to causes and that pathway can be unique (even if painfully obvious when pointed out) for two different sets of symptoms which point back to the same underlying problem. People don't search questions based on answers, they search them based on symptoms. Commented May 5, 2015 at 14:06
  • 3
    @ChrisStratton If you search on symptoms and find a question that's closed as a duplicate (i.e. is a signpost to the answer), you still get your answer. I simply don't see the need to repeat the information when we have the mechanism - closing as a duplicate - to point them towards an existing answer. Commented May 5, 2015 at 14:14
  • 1
    @AnthonyGrist No, duplicate questions are for duplicate questions. While the same answer can apply to two distinct questions, it certainly doesn't mean it's the best answer. Closing one of the questions as a duplicate prevents new, possibly more adapted answers, from being added.
    – Bruno
    Commented May 7, 2015 at 18:30
  • 1
    @Bruno Well essentially the questions are duplicates, because the problem is the same, as I explained above. Different phrasing and different example codes don't make it a different question.
    – Alex
    Commented Jul 9, 2015 at 7:05
-3

Q: What operating system begins with 'W'? A: Windows.

Q: Which operating system is the most popular? A: Windows.

As you can see, my answer is, "it depends." I think you should take it on a case by case basis. For example, if the intended meaning of question A is different from question B, but the answers are the same, then no, you should not mark either one as duplicate.

2
  • 2
    Possible duplicate of this ;-) Commented May 5, 2015 at 15:32
  • 2
    Possing duplicate of this, which has about 120 years' precedence.
    – abarnert
    Commented May 7, 2015 at 0:40
-4

What would have been the correct course of action here?

As far as I'm concerned, voting to close as a duplicate is the correct course of action. If literally identical answers will fully and entirely answer two questions, regardless of the wording used in the questions, then they're duplicates (ignoring, obviously, the absurd math examples people insist on bringing up).

The goal of the site is to construct a repository of useful questions and answers. One canonical answer, on a well written question, that fully explains a topic - and therefore should be sufficient to answer all questions that face the same issue - is better (from a community point of view) than a lot of answers that partially explain that topic.

Is it really forbidden to post the same answer to different questions?

As far as I know, yes. Re-posting another answer word for word - even if it's your own - is forbidden.

Should I have reworded the answer to use different words, even though it needed to say the same thing?

No, see the answer to the first question. You should have closed as a duplicate.

Would marking these questions as duplicates really have helped the OPs?

If the answer - without a single change - is sufficient to answer their question, then yes, obviously it would have helped them. What difference does it make to them if it's posted on their question or they're pointed to another question on the site to get the exact same information?

You must log in to answer this question.

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