Code formatting filter – is it really necessary?

The site can not accept an answer complaining about badly formatted code. I did all the 4 spaces thing, etc. And still after 3 hours the site did not accept my post.

Here is the copy of the answer I submitted initially: http://pastebin.com/P2HfWyCZ

Look, there is nothing strange about it, I used the {} at first, then switched to

<pre><code>


and nothing worked.

This is annoying and unnecessary. Why so much CARE about formatting code? Writing a "look here" + pastebin url seems like the most simple and workable approach, but defeats the purpose of stackoverflow

Your post appears to contain code that is not properly formatted as code. Please indent all code by 4 spaces using the code toolbar button or the CTRL+K keyboard shortcut. For more editing help, click the [?] toolbar icon.

• You're right, an external link is easier to browse and will last forever; moreover, code formatting is for loosers, a true programmer can read code even black on black. With its computer turned off. Nov 23, 2011 at 12:48
• What happens when the code at pastebin disappears? Your answer becomes useless.
– ChrisF Mod
Nov 23, 2011 at 12:50
• I edited your answer to clean it up a bit... Compare Your pastebin version with the version I clean up for you and tell me if you think it's better having the answer on the site, formatted nicely. Not trying to be a jerk, I'm trying to help you learn how to format posts for readability and therefore upvote goodness. Nov 23, 2011 at 12:54
• I see, you edited everything that remotely looks like code. I take no offense, and I appreciate your help. I do prefer that all the contents be on stackoverflow, I just pointed out that it was quicker and less troublesome to use a pastebin url, as well as my frustration with the automated code checker behavior. Nov 23, 2011 at 13:22
• FWIW, I wouldn't have upvoted your pastebin version. The edited version I probably would have.
– Yuck
Nov 23, 2011 at 13:26
• I see, you edited everything that remotely looks like code. Well I tried to make anything that was code look like code. If I'm talking about someFunction() in a sentence I backtick it so it's clear that it's code and not English. I also personally backtick false and && and such, but that's personal preference. Nov 23, 2011 at 13:53
• @TheUnhandledException: Nice try. But horizontal scrollbars are evil. I fixed it for you.
– user1228
Nov 23, 2011 at 16:04
• @ಠ_ಠWon't Awesome, thanks. That's why I love this community, we all work to make the content better! Nov 23, 2011 at 17:03

I'm guessing that the issue was because you mixed a lot of code with English. For example:

Remember this are bitfields and & is the "bit and" operator NOT the boolean && GDK_WINDOW_STATE_ICONIFIED =2 or 10 on binary and event->new_window_state is an int which second bit is active

A Widget can be both maximized AND minimized at the same time, GDK_WINDOW_STATE_MAXIMIZED = 4 or 100

If you use the backtick () around inline code, it improves readability:

Remember this are bitfields and & is the "bit and" operator not the boolean && GDK_WINDOW_STATE_ICONIFIED =2 or 10 on binary and event->new_window_state is an int which second bit is active

A Widget can be both maximized and minimized at the same time, GDK_WINDOW_STATE_MAXIMIZED = 4 or 100`

I edited your answer to clean it up a bit... Compare Your pastebin version with the version I clean up for you and tell me if you think it's better having the answer on the site, formatted nicely.

This is annoying and unnecessary. Why so much CARE about formatting code? Writing a "look here" + pastebin url seems like the most simple and workable approach, but defeats the purpose of stackoverflow

I disagree completely. It's really not that hard to format code properly. I'm sorry you're frustrated, but linking to a site where someone has to go to review the code is not a better solution in any way.

What happens if the pastebin is deleted? Your answer becomes useless. What happens if you want to refer to the pastebin? I don't want to switch between tabs just to understand your answer. Also, doesn't it take more time to open pastebin, create a paste, and insert the link than it does to just paste code on So and click the "format as code" button?

I see no advantage to using pastebin. What I see is a new user who is frustrated... we're here to help! If you can learn how Markdown formatting works you'll get a lot more enjoyment out of StackExchange.

• I did read the formatting help and faqs. And there was no warning that mixing regular text and programming symbols could lead to a problem. The editing box allows a button {} as well as the editor allows the <pre> tag leading the user to believe in its flexibility, it should be one or the other if strict formatting is so needed. I will not dig into if its is a ui design flaw or code flaw, but being a little more detailed on the help instructions about the strictness of the parser would really be helpful. Nov 23, 2011 at 13:40
• I agree, it can be a little tricky to get up to snuff on how to use Markdown... You could ask a new question on meta asking for advice on how to make markdown more accessible to new users. Just be prepared for downvotes, people downvote on meta when they don't like the idea and there's a lot of people who downvote anything critical, LOL Nov 23, 2011 at 13:51

I was able to post the exact same answer provided in the pastebin into a new answer without any problems (10k+ only).

Why so much CARE about formatting code?

You must be new here...those filters originated out of necessity, not because some programmer felt funny. There are many quality filters at work in Stack Exchange, and every single one was introduced because it was needed.

Edit: On second thought, maybe it's a low-rep filter, which doesn't apply to me anymore.

Rules and filters aside, it probably is a good idea anyway to make your questions as easy to read (by anyone) as possible. Since we're all here on a voluntary basis, the easier it is for other users to understand your problem, the more likely they will be to help out.

It's not even a matter of whether they will be more inclined to help out; if someone looks at your question and can't understand it, she wouldn't be able to answer your question even if she wanted to.

Posting a pastebin URL is much easier... for the poster. For someone who wants to answer the question, however, it requires visiting another site, having to copy and paste code if she wishes to provide examples or to annotate problematic code, etc.

And leaving aside all of that, if someone is scanning the site for problems to solve, since there's no code in your question (or at least, there wasn't any in the original revision), it is much easier to overlook or misunderstand the issue.

• My first post on stackoverflow was an answer,not a question. My first question/complain, was the result of my frustration at trying to post an answer to someone else problem. A problem which people will face eventually. So I wanted to put it where everyone could access and benefit from it. Pastebin is simple, posting here should be even simpler, that was my point. Otherwise I would not bother to complain and leave things as they were. Thanks to my complain, I learned things that weren't in the docs of this site, and the answer was helpfully edited and included by Josh/The Unhandled Exception. Nov 24, 2011 at 2:52
• Ah, nevermind; I misread your OP, and I think I then proceded to lecture you on something that is perfectly obvious to you. Sorry about that (:
– user164291
Nov 24, 2011 at 20:52