I have seen several questions containing code that is poorly formatted and totally devoid of comments. One recent example is this C example.

For a short code block that might be acceptable, but it is hard to provide meaningful commentary on a long block of code where it may take a lot of effort just to figure out what it is supposed to do.

I'm confident that the submitters of those questions would get more answers if the code was a little easier to understand. Neither the How to Ask sidebar nor the faq mention this. Could they be updated?

I'm not sure there should be a firm rule that poorly formatted or commented code should get a question deleted, but it might be helpful to point out that reasonable formatting and commenting are more likely to get answered.


2 Answers 2


Missing formatting is in itself a reason to criticise code, so it can be part of the answer, to reformat it. For some languages at least, there are prettyfiers available (c, java, ...), so you needn't do it by hand.

If the question is about advanced topics, but the formattin is bad, even for a beginner, downvoting seems appropriate for me; at least a comment, asking for reformatting, should be done.

And yes, even flagging to close.


We do now have the ability to detect unformatted code; I will turn that on here.

Can we detect unformatted code and give specific help?

  • \$\begingroup\$ That's a great feature, but it sounds a little different from what I was asking about. I was referring to code samples where no lines have any indentation so it's hard to visualize where the loops and conditionals are. \$\endgroup\$
    – jimreed
    Jul 15, 2011 at 17:24

You must log in to answer this question.

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