5

Question: If a user posts a question Q and the answer to that question is "X, because Y", should the question be closed as an exact duplicate to another question that asks "What is Y?"

Perhaps an example would help.

Today, a user posted a C++ question that asked:

What would the following snippet display?

int i = 10;
i = ++i + (i++) + (++i) + i;
cout << i;

Of course, the answer to this question is:

It could display anything because your code exhibits Undefined Behavior.

The question was closed as an Exact Duplicate to another question that asked a completely different question: "What is the difference between [Undefined, unspecified and implementation-defined behavior]?"

Should the question have been closed as an exact duplicate to a different question?

I didn't think so, and here is why:

The OP to the closed question didn't ask "What is Undefined Behavior?" They asked what their code, which exhibited Undefined Behavior, should do. If this user is trying to write such code, it's pretty clear to me that they don't yet know enough about C++ to know that their code was broken.

I don't think that abruptly closing the question with a link to a Standard-ese, detailed definition of Undefined Behavior is helping the OP. It just confuses them. (In fact, the OP in that particular example might agree, as they commented themselves "No way it was an Exact Duplicate!")

Rather, I suggest that either

  1. The question should be closed as a duplicate of another question asking the exact same question (in another context, of course)

  2. The question should be answered thusly:

"It could display anything because your code exhibits Undefined Behavior when you try to assign to the variable i more than once without an intervening Sequence Point. Here are some links that describe UB and Sequence Points in greater detail..." and then follow up with those links.

4
  • I understand that the reasons for up & down voting something on meta are different than the reasons for same on non-meta, so if you downvote I assume you disagree? Please feel free to explain why you disagree. Oct 21, 2011 at 20:44
  • 1
    (Not your down voter) I believe the question was indeed an exact duplicate, although the cited question wasn't the best example. I think a better one may have been this: stackoverflow.com/questions/949433/… Oct 21, 2011 at 20:55
  • Downvotes here on meta mean disagreement over the OP's views.I am the downvoter,and I have explained myself adequately in an answer.
    – Alok Save
    Oct 21, 2011 at 20:57
  • @Fred: I don't disagree that it should have been closed. I would have been happy with the link you provided, had I had it at hand. What I disagree with is closing it as a duplicate of what it was marked a duplicate of. Oct 21, 2011 at 20:58

3 Answers 3

7

Question: If a user posts a question Q and the answer to that question is "X, because Y", should the question be closed as an exact duplicate to another question that asks "What is Y?"

I'd say no. In fact Joel calls this out in The Wikipedia of Long Tail Programming Questions

If you’re going to close a user’s question as a duplicate, it has to be a real duplicate. For example, if a user asks, “What does the IP address 128.0.1.1/24 mean?” it’s OK to close that as a duplicate of a more general question like “What do IP addresses of the form a.b.c.d/e mean?” But it’s not OK to close it as a duplicate of a twenty-seven page guide to netmasks. That’s the moral equivalent of saying “RTFM.”

However since more appropriate questions exist its easy enough to just edit the question to include additional links.

2

Being the OP in this case, I was able to figure out the answer to my question from the FAQ that was tagged to it. Though it was like handing over a geography textbook to person who happens to ask "Where exactly is Himalaya?". Which an OP may or may not like.

0

In case the linked Q's do not explain the details of what an OP is asking it makes perfect sense to add relevant information as answers but in this particular case, there have been excellent faq entries on the C++ tag which explain the subtle details of Sequence points and Undefined behavior in completeness and minute detail.An OP searching for answers is expected to search for duplicates before posting an Q.An quick search should have indicated the OP of those very Q's.If the OP fails to detect such relevant detailed Q's and to refer to answers on them,it then becomes the responsibility of the regular and more experienced users to link the Q to such excellent answers and do the appropriate thing(vote to close).I feel that is the right thing to do because such Q's which have been answered in detail n times before do not add anything constructive to the future users.

Atleast 4-5 excellent Q links which discuss at length the same Q as OP asked were posted on the users Q in this case and yet instead of reading them or understanding them the user complains "No way it was an Exact Duplicate!" instantaneously, which can't be helped.users need to be proactive and try to actually seek answers to their Q's in information they are pointed to.It should be the OP's responsibility to help others help them learn.

4
  • 1
    Re: "there have been excellent faq entries..." OK, but a newbie C++ programmer won't know what a sequence point is, or what Undefined Behavior is. They certainly won't know to search for "UB" when trying to figure out what their code will do. Oct 21, 2011 at 21:03
  • 1
    Re: "An OP searching for answers is expected to search for duplicates" OK, but the OP wasn't linked to one of those duplicates. They were linked elsewhere, to the root cause. Oct 21, 2011 at 21:04
  • @JohnDibling: The excellent faq entrythat you yourself linked to describes sequence points and the semantics of it leading to undefined Behavior more aptly than any book can.
    – Alok Save
    Oct 21, 2011 at 21:14
  • @JohnDibling: And if you feel an apt duplicate is not linked already, then you should be linking to the one you feel is a better choice Or post it as an comment,So OP can look it up.
    – Alok Save
    Oct 21, 2011 at 21:19

You must log in to answer this question.

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