35

This question: C structure as a data type received some very good answers, one of them got 20 upvotes and was accepted. Technically, all posted answers either said that what the asker wanted to do was impossible, or suggested changing his original code to do what he was trying to do in a different and much more adequate way.

I posted an answer that actually did precisely what the asker was asking for, and without making amends to his original code, but in quite a terrible manner (albeit the only possible one with the aforementioned conditions). I intended it as a sort of a joke, directly saying that what I was suggesting produces "monstrosities" in the code.

The answer received two upvotes and two downvotes, and got accepted (!). I left a comment saying that this was the wrong way to go, but I am not sure if this is enough.

What do I do now? Do I delete this answer so that the asker accepts the much-better one by @tmlen?

EDIT:

I got quite embarassed with the situation, especially after the answer going into negative score, and when a mod approached me in the comments and suggested that he delete it, I agreed. But all the input from you people makes me doubt my decision... If I ask a mod to undelete it now, will it still be marked as accepted?

11
  • 8
    You can't delete it now that it's accepted.
    – user000001
    Commented Apr 26, 2015 at 10:51
  • @user000001: but it still shows the "delete" button...
    – user3079266
    Commented Apr 26, 2015 at 10:56
  • 2
    If you click the button (and say OK to the popup) it will say You can't delete this accepted answer.. In any case I wouldn't recommend deleting it. It still answers the question, and you never know, it might help somebody in the future.
    – user000001
    Commented Apr 26, 2015 at 10:59
  • 4
    If you really want to delete it, then flag it for moderator attention clearly stating what the problem is. They will be able to delete it.
    – Arun A S
    Commented Apr 26, 2015 at 11:23
  • 19
    Edit the post and add why it's such a terrible way to do it.
    – Jongware
    Commented Apr 26, 2015 at 13:12
  • 3
    The answer somehow disappeared.
    – jkd
    Commented Apr 27, 2015 at 4:56
  • 4
    @jakekimds: the answer started attracting lots of downvotes, people didn't find the joke funny. So a mod suggested that he delete it, and I agreed to avoid more embarassment.
    – user3079266
    Commented Apr 27, 2015 at 7:27
  • 6
    When I give an answer that literally answers the question but is a terrible practice, I like to preface it with "Treating your question as academic..." Commented Apr 27, 2015 at 17:20
  • The edit this this question is quite substantial, and really a separate question. I suggest providing a link back to this question in a new question.
    – ryanyuyu
    Commented Apr 27, 2015 at 18:36
  • 2
    "For entertainment purposes only" Commented Apr 28, 2015 at 7:12
  • Now that the answer's been deleted, I'm curious - what was your answer? Commented Apr 9, 2019 at 19:15

4 Answers 4

49

Leave it.

Anyone who has been here awhile knows that an accepted answer isn't necessarily correct or best practice. What the acceptance means is that the user deemed your answer the most useful.

Provided you have clearly stated that your code is a monstrosity then your conscience is clean. This particular user didn't care, and future users will know.

As for flagging it for ♦ mod attention - you could, but that's no guarantee that your answer will be removed. Moderators are not arbiters of technical accuracy, they are there to square away the things that regular people can't do.

7
  • 15
    I really hope this answer is not a joke. It seems quite serious but you never know!
    – Jongware
    Commented Apr 26, 2015 at 13:10
  • 11
    @Jongware No, not a joke. Probably most of us have done it at some stage - answer with a bit of code that does what the OP wanted but then follow it with a big "use at your own risk" warning.
    – slugster
    Commented Apr 26, 2015 at 13:12
  • 2
    Yeah sorry -- my comment was meant jocular. I also admit to having cruelly posted answers that do exactly what was asked (ha ha!). Dunno, though, if one was ever accepted.
    – Jongware
    Commented Apr 26, 2015 at 13:15
  • 4
    "clearly stated that your code is a monstrosity" -- best to do this in the body of the answer, though, not just in a comment, @Mints.
    – jscs
    Commented Apr 26, 2015 at 18:54
  • 14
    "Anyone who has been here awhile" - but what about the people who haven't? Because people who haven't been here a while make up a very large portion of the people who will read that answer. Commented Apr 27, 2015 at 0:55
  • @user2357112 That's what the big "This code is a monstrosity" warning is for. If a visitor can't be bothered to read the explanation of the code they're using, then the bad code is their own fault.
    – jpmc26
    Commented Apr 27, 2015 at 17:07
  • 4
    I think there's a difference between posting an earnest answer that you know isn't ideal, and posting an answer as a joke which you have never intended anybody to use. If it were me, I would delete the answer. Commented Apr 27, 2015 at 18:23
26

Edit the answer to add a bigger disclaimer, if that makes you feel better.

14

Trojan it.

Now you are accepted, you have the checkmark of destiny. You understand that your answer is horrible, so improve your answer. This might involve regulating your existing answer to a heavily "hidden" sub-clause with lots of qualifiers that describes why it is a bad idea.

The main thread of the answer should then become whatever you think the correct answer is.

To be honest about it, notify the OP that you have heavily changed your answer, as your original answer was a joke.

Assuming the original poster asked the question, got an answer, and never comes back, you'll remain the top answer. Use your platform well, improve your answer, and make the world a better place.

2
  • But I can't add any more to my answer besides what was posted in other answers already! And if I just wrote the same, it would be unfair to the other answerers... And would attract even more negative feelings since it would be obvious that my answer was posted later.
    – user3079266
    Commented Apr 27, 2015 at 18:51
  • 12
    @Mints97 acknowledge their answers in yours, and explain that their answers are better, so you folded them in. Stealing-with-attribution on SO is acceptable, especially if it makes the site better. You got nominated to curate the best answer: that is a responsibility. Make it the best answer. Commented Apr 27, 2015 at 19:03
8

There is really nothing wrong in posting answer that solves OP problem in exactly the way it is asked. There are cases when following worst possible practices is the most acceptable choice.

Note that reputation of person asking the question can't be used as guide for whether OP just clueless and typed in random code OR actually spend days picking only plausible solution. (Also question itself will likely immediately show the difference).

Such answer definitely need opening section like "There common practice to solve is ....., if you must get this exact syntax (i.e. ..... [due to legacy system constraints, compiler]) you can ....".

Back to exact that question triggered this post: "But I do not like the ..." is clearly not the reason to provide real complete answer like that. I'd stop at "you can use XXXXX" at most.

You must log in to answer this question.