Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

From what I understand, code that doesn't have a license associated with it is considered copyrighted by the original author implicitly (and technically no one has been granted any rights to use the code). Therefore, it usually is in the best interest of others for an author to license code intended to help others. Typically permissive free software licenses such as the MIT License is a good fit for these types on things. That said, should code snippets/examples be licensed on sites like this? Or is that not necessary?

If the answer is yes it should be licensed, then why not include the ability to attach a license to code examples provided as an answer to a question.

share|improve this question
note that the code gets currently already licensed under CC-Wiki, just as all the other content. Whether this is sufficient for code is a different question though – Pëkka Mar 8 '11 at 14:19
up vote 5 down vote accepted

As @Pekka points out all content on SO gets licensed as CC-Wiki - so really this feature is required if that license is insufficient for code snippets.

If SO had lots of long technical articles explaining the implementation of some feature or other then that would be an issue. On sites like Code Project this would be relevant and they use The Code Project Open License (CPOL) 1.02, main points:

  • Source Code and Executable Files can be used in commercial applications;
  • Source Code and Executable Files can be redistributed; and
  • Source Code can be modified to create derivative works.
  • No claim of suitability, guarantee, or any warranty whatsoever is provided. The software is provided "as-is".
  • The Article(s) accompanying the Work may not be distributed or republished without the Author's consent

But as the answers to questions that contain code snippets on SO are too short to really constitute licensable software I can't see that explicit licenses are necessary. I would suggest that if a piece of code published as an answer on SO is so groundbreaking that it requires additional licensing then it probably shouldn't be used.

share|improve this answer

You must log in to answer this question.

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