Sometimes I encounter questions on Stack Overflow where it appears that the asker should have just tried the code for themselves. Fer example, I've seen questions such as (in its simplest form):

In C, if I do printf("something");, will it print something to screen?


I have the following code: [code snippet] If I run it, will it do [something]?

I usually downvote such questions, because the tooltip on the downvote button actually states "This question does not show research effort...".

But I feel those questions should be closed, because they don't bring anything useful: most people will just try it before actually asking about it. However, I'm not sure what reason to offer to its closure, because none of them seem to apply to this specific case.

Is this a good case of a "too localized" close vote? Honestly I've tried that before, but nobody seems to go for it except me.

How should I treat a question where the asker just could have tried the actual code?

  • 3
    I don't know... questions like that to me are down-vote fodder. Either they did not do enough "research" themselves or didn't even bother to describe their situation thoroughly enough for us to understand their intentions. Those are borderline "not a real question" or "too localized." – Jeff Mercado Mar 2 '12 at 3:10
  • Of course the correct answer to the example question above is "No". – celtschk Mar 2 '12 at 8:57

...the asker just could have tried the actual code

You have to be really careful making that assumption about programming questions, particularly in languages like C and C++ where you can have undefined behavior. In other words, just because a particular piece of code appears to run and work on your system's implementation of C does not mean that it is valid C and that you can assume it will work identically across all implementations.

Sometimes questions that look really simple are actually hiding quite a bit of complexity just under the surface. Closing these questions as "shoulda just tried the damn code" is thus not very constructive and definitely sends the wrong message.

And I say all of that as someone who regularly uses all 50 of his close votes on Stack Overflow. You have to be careful closing questions for this reason alone. Sometimes I will leave a comment that says something like,

This shouldn't be a problem; have you tried running the code yourself? What happened?

and see if they respond with "oh yeah guess I could . . . edit: it works! herp derp" before voting to close. On the other hand, if they indicate that they're aware one can compile and test code, but they're looking for a different answer, then that question deserves to remain open (perhaps with an edit or two clarifying the subtleties).

The first question you cite is a good example:

In C, if I do printf("something");, will it print something to screen?

The answer is actually a bit more complicated than "yes" or "no". Yes, in most cases it will print to the screen. But the printf function actually prints to the standard output stream. That's usually the screen, but it doesn't have to be. Et cetera. That's the kind of answer that should ideally be given, not "yes, it prints to the screen; try the freakin' code yourself".

Keep in mind that there is no question too "simple" or "basic" for Stack Overflow. As long as it is well-asked and reasonably answerable, it should be allowed. The "RTFM" close reason has not yet been approved, and for good reason (I think).

Anyway, end of rant. If you do come across a question that is literally "what does this code do?" (as opposed to, perhaps, "what does this code mean?" or a whole host of other potentially complex questions—see how tricky it is to make general rules about this kind of thing?), then yes, voting to close as either "too localized" or "not a real question" would be appropriate.

If not enough users agree with your close vote, well then you were probably wrong. That's entirely by design and why closing requires 5 votes. Don't sweat it too much.

| improve this answer | |
  • 1
    You need to start concluding your posts with a tl;dr version. This giant wall of text is scaring me a little. – Mystery Mar 2 '12 at 2:58
  • 2
    @Purmou: Just like reading a book, you can generally get the gist of an argument by reading the first couple of lines and last couple of lines. If I had time and knew how to summarize it myself, I'd have time to post a shorter answer in the first place. I stopped participating in online forums because I got tired of everything being tl;dr. It probably won't surprise you to learn that I don't have a Twitter account. – Cody Gray Mar 2 '12 at 3:01
  • I agree that you have to be really careful about those situations. Whenever I'm about to cast a close vote, I really ask myself: should this question be closed? Like you said, in C, it's not that obvious. In some other languages though, especially scripting languages, it is, so it was more of a general question. The "comment first, then see what happens" approach also seems reasonable. Thanks a bunch for your input. – netcoder Mar 2 '12 at 3:02
  • @CodyGray: Good point--long answers that should be long are just fine, and this one fits the bill. I, by the way, agree wholeheartedly. – Mystery Mar 2 '12 at 3:03
  • I got the gist of this post in the first sentence fragment. It's a very good point, too. However, there are still many questions that do apply as so simple, someone should simply have tried. – Andrew Barber Mar 2 '12 at 3:07
  • 1
    @Andrew: That's what the rest of the answer is about. To keep people from posting *"Yeah, but..." comments. Looks like it didn't work. :-) – Cody Gray Mar 2 '12 at 3:10
  • @CodyGray I worded my comment clumsily. I actually did read it all! hehe – Andrew Barber Mar 2 '12 at 3:16

You must log in to answer this question.

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