There seems to have been a marked increase (at least on the C++ tags) of people asking questions and referring the reader to code posted on pastebin and similar sites. I always post a comment on these telling the questioner to post the code on SO, and refuse to answer until they do so.

Would it not be possible to detect pastebin and similar URLs in the question, and to at least give a warning that this is not good practice?

  • 5
  • 16
    Warning yes, ban no. Jun 12, 2011 at 10:11
  • 2
    Ban then, and then warn them. Its the only way to be sure.
    – user1228
    Jun 13, 2011 at 12:44
  • 1
    Just came to complain about this, starting to find more and more dead links to pastebin where the content has expired, makes our huge archive of useful answers to questions utterly useless.
    – Louis
    Sep 26, 2011 at 0:43
  • Although I understand it's very nice to ensure you actually do get the code (because broken links happen), it's important to realize that posting code here will give the code the CC-BY-SA license, which even according to the makers of CC is not a software license, and it's incompatible with the GPL. People don't want to make their code so they can't use it in open source projects or for their businesses proprietary projects and such; so, I think it makes perfect sense to use pastebin until stackexchange changes their license policy to allow for such as MIT (or at least GPL) licensed code. Oct 30, 2014 at 10:33
  • However, I think people who post their stuff on external sites should still explain the algorithm and declare a license. However, I think this practice would be much more acceptable in answers than questions (which questions typically don't use exact code, anyway). Oct 30, 2014 at 10:42

3 Answers 3


I agree with you that the code should always be present in the question so that a user can read the question and understand it in it's entirety without visiting external sites. However, This could be a problem on the JS tags as we encourage people to post a link to jsfiddle or jsbin in addition to the code in the question.

Any warning would have to be made only if

  1. A code block is not present in the question
  2. The question contains a link to a *bin site
  • I agree; however the JSFiddle is usually done so to reproduce the problem, the answer should be explained on SO directly as to not requiring external resources. Dead links to answers you need are an utter pain.
    – Louis
    Sep 26, 2011 at 0:45

Actually, some other sites provide some functionality (e.g. jsfiddle), that makes it easier to work on the question. What we should think about is to have some code from those sites to automatically be included in the answer, if a link to such a site is posted. That way, we preserve the code from disappearing and still will be able to use the extended functionality of those specialized sites.

  • 1
    This was my thought, replicate and store on SE's servers to ensure future availability.
    – Louis
    Sep 26, 2011 at 0:46

My experience (mostly reading the C, C++ and Java tags) has been that questions on pastebin and co. are often of low quality, even if you imagined that the code in question was inlined.

Usually this is indicative of another problem - "my code is too big to fit sensibly in a question page", which seems to make for a poor question regardless of where the code is hosted. 200 lines taken directly from a 100K LOC project is really hard to analyze in any meaningful way and often the problem itself stems from undefined behaviour elsewhere.

Some kind of warning about good questions using short, self contained correct examples, with all the benefits they bring would, in my view, help improve the quality of some of these questions.

You must log in to answer this question.

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