Disclaimer: I am not trying to chastise anyone for their answers, as I appreciate receiving answers attempting to assist me which are given entirely out of a desire to help others. So please don't see this as a request to mass downvote answers. I would have refrained from posting a link, but it is necessary for this question.

I asked a question requesting a solution to a specific problem with clearly stated constraints and requirements. The question was

How can I make the program terminate upon receiving a scalar multiple of 65 characters and then a ctrl-D?

But the question seems to be getting only critiques aspects of my program not addressing the actual problem that I'm facing, e.g. re-designing the program entirely or ignoring some of the constraints. Now I'm not necessarily complaining about this, because I'm not entirely sure if these kinds of answers are considered acceptable on stackoverflow or not, but to me it seems equivalent to someone asking "How do I run Netflix in Linux?" and receiving an answer of "Use Windows instead". It's a suggestion that would solve the problem, but it doesn't answer the question.

So my question is, is there a certain way that the question is phrased which explains why it is soliciting these types of responses? And is there a certain way to phrase it in order to avoid receiving them? I know receiving these types of responses isn't terribly detrimental, my only concern is that I'm not phrasing my question properly and so it is being misunderstood.

  • In this case, I think the answer by Basile is actually valid, while the other two are too short to be helpful. In the future, I recommend specifying exactly what your constraints are on your code; if the buffer size is an exact constraint, state that you cannot change it. Hopefully this helps in the future!
    – user206222
    Aug 11, 2013 at 8:00
  • @ShaWizDowArd Why the ethics tag? Aug 11, 2013 at 8:09
  • 1
    Because you're asking if it's right or wrong to post such responses as those you got. Aug 11, 2013 at 8:36

1 Answer 1


When you ask programmers how to do something, they're going to tell you what they think is the best way to do it. This is particularly true of knowledgeable, experienced programmers, the ones that frequently roam the halls of Stack Overflow and likely the very reason you chose to ask your question there in the first place. You've asked them to share their knowledge, and that's exactly what they're doing.

It's not merely an arrogance thing. They have learned through experience that doing things the wrong way is a source of bugs, and it is one that is quite easy to avoid. There is a reason they are called "best practices": because they really are the best way to do things in 99% of cases. Worse, even if we ignore all of the other problems and address only the issue you asked about, we know that you'll be back in a few minutes, hours, or days asking another question trying to solve a problem that could have been foreseen and averted long ago. (Related reading: X-Y problems; all too common here.)

Having a low reputation score next to your name tends to bring this out even more. It isn't because we think you're stupid or "uncool", of course. We just assume that you're relatively new and may not know the right way to do things yet. None of us did at first. We give you credit for being willing to learn, and we're willing to teach. Worse, in the C and C++ tags, we assume that you may be learning from one of the many outdated or downright wrong books out there on those languages. Before I clicked through to see the actual question, I figured it would be another one of those cases where you'd asked a question with the C++ tag but used a bunch of C functions, like printf. Lots of so-called "C++" books still teach the C way to do things, and it raises the ire and suspicions of experienced C++ programmers reading your question.

Of course, it's not just isolated to a low reputation score. Experts are equal-opportunity nitpickers. I have some 80k in reputation right now, but if I posted a question that included a bunch of code doing things counter to intuition and/or best practices, I would get plenty of comments from well-meaning people telling me of a better way to do it. Some of them would be snarky (comes with the territory), some would simply be inquisitive, and others would be genuine, honest-to-goodness constructive suggestions. All, of course, would be useful.

The truth is, you need to learn to appreciate and embrace this aspect of an expert Q&A site. You might not know it at the time, but the advice people can give you is invaluable. We don't explicitly do code reviews here (you need to have an actual problem to be solved), but then again we do. And you can learn so much from it. Like I said way up there, it's got to be at least part of the reason you brought your problem to Stack Overflow in the first place.

But okay, blah blah blah, you know all of that already. Whether you look like a n00b or not, you've got a darn good reason for doing things the way you're doing them and you don't need to be told that it lacks the blessing of the C gods. The simple solution is to explain yourself. Ask the question, show the code, and then simply observe that you know you're doing some "weird" things, but you have a reason for them. Tell us why you're doing it and tell us what your constraints are. Not only will that keep us from telling you things you don't want to know, it will also make the answers better by avoiding incorrect assumptions and the use of unacceptable functions. Improving your question through editing, as you've done, is exactly what you should be doing.

Still, don't be too quick to put your fingers in your ears and tune out the suggestions of these folks. They really do mean well, and the truth is that they're right most of the time. Even if you end up ignoring their advice, it doesn't hurt to hear it. And it certainly doesn't hurt for it to be there when someone else with the same problem (and without the same constraints) happens across your question looking for a solution to the same problem.

Most of this stuff happens in comments. That's totally acceptable; don't let it bother you too much. Good answers also tend to explain and give advice on more than just the narrowly-focused problem you've asked about. Also completely acceptable, like a two-for-one special.

The only thing that's a problem are answers that fundamentally do not contain an answer your question. Downvote those. Leave a comment to that end, if you like. If your question was clear and these people chose to ignore it, that's their fault. They know what the answer box is for.

You must log in to answer this question.

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