What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 133 Stack Exchange communities.

Why was my answer to Stack Overflow question How to correctly implement a dynamic array in C deleted?

The OP's question had code (which was later on revised by the OP) with a lot of potential bugs to start with, which could have been causing a segmentation fault. It would have been inaccurate to exactly point out the section of the code where the actual problem was, at that point of time. So, I answered the question with my suggestions on what OP should try on the code, so that we could answer the question precisely. My answer did get upvotes, too, which does prove that people did agree with my viewpoint of answer. And "No", it's not commentary on the question nor could it have been a comment. The answer contained many solutions, because there were many problems in the question.

The original answer I posted:

A few points:

* In the functions you need to use `realloc`.

* You need to learn the use of `free()` function

* You have to allocate memory to `datArr` and check if its successfully done, before storing string `s` in it.

* You need to learn pointers too(referencing and de-referencing).

* You must check if the pointers are NULL or not before using them.

* Learn `memset()`.
share|improve this question
3  
That seems like a list of comments rolled into an answer, but in toto they don't really answer the question. –  jonsca Dec 9 '12 at 14:08
1  
So you say that I should write the entire working code to show what was wrong with the code? Please note that the OP comments in response to another answer quoting the terms my answers had and then answered own question and in edited question writes the NOTE. –  askmish Dec 9 '12 at 14:13
    
This is not to say that you didn't do the right thing in trying to teach, but in the long-term, the answer won't really necessarily help someone with that specific problem who goes to look for information. –  jonsca Dec 9 '12 at 14:14
1  
Your answer is more or less like to say : a few points: You need to learn programming, and you must learn computers - is not an answer. The learn memset() is not an answer 100% - the user ask what you know and how to help him. –  Aristos Dec 9 '12 at 14:15
    
(our comments crossed) Well, perhaps either offer snippets related to the problem or simply leave your advice as separate comments. Admittedly, it is often hard to know in these situations. –  jonsca Dec 9 '12 at 14:15
    
[On the how to answer page as I read ](stackoverflow.com/questions/how-to-answer)*The answer can be “don’t do that”, but it should also include “try this instead”. Any answer that gets the asker going in the right direction is helpful, but do try to mention any limitations, assumptions or simplifications in your answer.* –  askmish Dec 9 '12 at 14:17
    
@askmish The answer to every programming question here can be reduced to "Learn how to do what you are asking us to teach you", but this is not a helpful answer. –  Asad Dec 9 '12 at 14:21
2  
"try this instead" should be a concrete solution. What if I answered your question here with "That's the way it is. Sorry, just learn more about what makes something an answer"? It's "an answer" to your Meta.SO question, but it's not very satisfying, it's not complete, and doesn't really help anyone that encounters your question in the future. –  jonsca Dec 9 '12 at 14:21
1  
FYI the question still contained the bugs even if the OP's accepted answer was updated to the code. The person who answered after me, fixed bugs indicated by me. The OP in the comments to another answer acknowledges that he/she knows about those bugs in own code post commenting on my answer. OP Writes a note in own question as an edit. I don't bother about the points I lost, nor OP's rational, but I cannot just get what kind of answers a question with several bugs can expect? –  askmish Dec 9 '12 at 14:29
2  
@Aristos I didn't tell to search for stuff. I pointed out how OP's code could improve. I do not understand how this cannot be an answer? –  askmish Dec 9 '12 at 14:31
1  
@Aristos at times people dont even do that (search), so telling them to search is valid in those scenarios. –  AsheeshR Dec 9 '12 at 14:42
    
@askmish Maybe you know and give some good knowledge, but the way you give it is non actually helpfull, is not make it answer but guide where to look for. –  Aristos Dec 9 '12 at 21:11

3 Answers 3

up vote 5 down vote accepted

As others have pointed out, what you posted wasn't really an answer according to our rules.

I sympathize: this is one of the huge shortcomings of Stack Overflow's Q&A model, and it takes part of the fun out of visiting it. There is no dedicated place to teach people how to fish, and it gets rewarded less than doing the fishing for the OP. I see dozens of "why doesn't this work" questions every day and what those people really need is to be taught the basics of debugging. Instead, you'll see a rush of "hey, you have a typo in line x" answers that are essentially worthless because they don't help the OP become a better programmer, but they get upvoted and accepted because, well, they answer the question...

If you want to teach a person to fish instead, you have three options:

  1. Cease providing answers; teach how to fish (= debug) in comments instead.

  2. Provide answers that a.) actually answer the specific question and b.) teach how to fish in addition to that.

  3. Turn away from these kinds of questions and look for more advanced ones.

Both 1. and 2. won't work if you're here for the rep - but they arguably provide a service to the community at large and make the site a better place, so if you feel inclined to do this, do it.

share|improve this answer
2  
This is great advice. I know comments are supposed to be used to seek clarification or help improve an answer, but unofficially they do a lot more and are less likely to be moderated in this manner. –  jmort253 Dec 9 '12 at 22:43
1  
Option 4, start thinking about how Stack Overflow/Exchange could be extended to encourage helping people learn to fish... Otherwise we're all going to stay Morts. –  Benjol Dec 10 '12 at 9:06
1  
@Benjol I have a feeling the people in charge don't have this on their priorities list... and arguably, it's still running quite okay despite this. (To clarify: Benjol is referring this Mort, not the jmort above :) –  Pëkka Dec 10 '12 at 9:13
    
@Pekka: Thanks. I appreciate your approach in answering my question. And perhaps you've explained my viewpoint quite well. My efforts are in best interests of building a better, collaborative community, at large. But, if we don't help these OPs, who else will? I was actually trying to help them instead of just fixing bugs in their code, for now, which most of us, actually do in SO. But, as you suggested, I should be happy by just answering the questions straight to the point. –  askmish Dec 10 '12 at 17:01

I don't think general advice like

  • You need to learn the use of free() function
  • You need to learn pointers too(referencing and de-referencing).
  • Learn memset().

can really be considered an answer to the specific question that was asked. Sure, I agree with those guidelines (which explains why people might have upvoted your post), but that still doesn't make it an answer to the question that was asked.

The rest of your bullets were slightly-to-moderately more specific to the question, but I think they could have been fit into a comment. I agree with the flagger that what you posted isn't really an answer to the question. You can update your answer to make it more specific to what's being asked if you want to have it restored.

share|improve this answer
    
why should I change the question? and suggesting cannot be helpful? –  askmish Dec 9 '12 at 14:52
3  
@askmish Change the answer. I could make the suggestions above on almost any question tagged c. They might be helpful, but that doesn't make them a good or relevant answer. Leave them as comments. –  Bill the Lizard Dec 9 '12 at 14:55
    
Yes, the answer is still relevant to the question,even now.And you can write such "general advice" in almost every answer tagged in C. But, I don't do that. I suggested them, because I found out that at several places in the code they were having such problems. I do realize though, that SO is just another QnA site where you shouldn't post the suggestions(because they can be generalized), just the relevant codes which will fix OP's question. –  askmish Dec 9 '12 at 15:10
1  
And FYI:This is more specific answer as to why my answer has been deleted: deleted by casperOne♦ Nov 5 at 12:36 Why was your post deleted? See the faq. –  askmish Dec 9 '12 at 15:12

This was just suggestions towards the OP instead of an accurate answer. If I saw that someone posted something like this to one of my questions id think of it as an insult like your trying to tell me I don't know my stuff which is probably the way a moderator took it when he/she removed it.

share|improve this answer
    
No, the post was removed because it didn't answer the question. The suggestions were presented in a positive manner, it's just that Stack Overflow answers are ... well... for concrete answers to the question being asked. It shouldn't ever be taken as an insult if someone is just merely pointing out something you're doing wrong, however... But in general, no, moderators will not remove an answer just because he doesn't like it. –  jmort253 Dec 9 '12 at 22:36
    
I understand where you are coming from but what I was saying is that the answer would seem a bit insulting at the same time not answering the question. –  m44m31 Dec 9 '12 at 22:44
    
We're getting a bit off-topic, but I want to say that if you're going to be insulted by someone politely telling you you're doing something wrong, you may find that you really struggle as a successful programmer. For instance, I make mistakes all the time that I learn from, and I've been doing this for awhile. ;) In fact, the times I've learned the most stuff was when people showed me why I was wrong. If I got insulted everytime someone did that, I wouldn't have learned to avoid those mistakes...... By the way, welcome to Meta Stack Overflow! :) –  jmort253 Dec 9 '12 at 22:47
    
Thanks mate! I din't mean to offend you at all if I did, I was just trying to point out that 1) His answer did not answer the question 2) Because of the way it was written and for the fact it did not answer the question it was a bit rude Once again sorry if I offended you. –  m44m31 Dec 9 '12 at 22:50
    
No offense at all ;) I just wanted to point out that Stack Overflow has a very clear definition of how to answer a question on Stack Overflow and that it wasn't removed because it was perceived as being insulting. You can read more about that in the FAQ page on deletion. Good luck! :) –  jmort253 Dec 9 '12 at 22:52
    
@m44m31: My answer was in a positive spirit and a broader sense of helping the OP make his/her own code bug-free and avoid getting into similar problems, in future again. –  askmish Dec 10 '12 at 17:07

You must log in to answer this question.

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