# How closely can code on this site be copied into other projects?

I understand that code found on Stack Exchange is under a Creative Commons License. This stipulates that

1. any projects using the code must be shared with same (or compatible) license, and
2. the author must be credited.

This doesn't work well in some situations, such as closed source projects or projects that fall under and incompatible license (like MIT or Apache). Also, just from a practical perspective, how can credit be given when most users don't use their real name?

Normally it's ok to get the idea behind an answer, and just take the gist of it without worrying about licensing or copyright. This works with sites like Stack Overflow. But Code Review is different. It's literally about the specific code, and any change would make a difference. For example, on SO someone could recommend using a function and this wouldn't be copyrightable. But on Code Review an answer would detail exactly how to call the function and what variable names work best etc. So copying and pasting seems inevitable if this site is to be used correctly.

Am I understanding things correct? What is the community's position on the matter? Here a prominent member of this community argued against the use of the MIT license, which I find strange.

For example if an answer is

line 5 should be replaced with foo(!bar(myName, yourName));

would someone be able to use it in a closed source project?

There are key components to this question that I think are missing to be able to accurately answer. But what is probably more important, is that a site for programmers is unlikely to have a lawyer that knows all the ins and outs of your question. And I doubt they'd be able to actually accurately answer this question without writing a large book.

But there's a simple solution.

I have in the past asked people to release the code in their answer to me under MIT, and I have had someone use my code in a GPL project, which the Creative Commons license allows.

If you want some code to be released to you in a license that isn't CC BY-SA 3.0, just ask the answerer.

• The claim of the final paragraph is legally incorrect. The author of the code has separately licensed their work to you under a license you both agreed on. The license they have given SE is not affected by that in any way, shape or form, because it is non-exclusive. – Vogel612 Jul 23 '19 at 18:25
• @Vogel612 No it isn't, they're different agreements, and function independently. Since a user agrees to both the TOS and the TOS says you need to attribute it doesn't matter if the license is WTFPL because it'd be a TOS violation not a licensing violation. – Peilonrayz Jul 24 '19 at 1:08
• ohhhh. so you'd have to ask them to send the code to you through a different channel for the TOS to not apply. Stuff like this is why I'm happy to not be a lawyer :D – Vogel612 Jul 24 '19 at 1:20
• @PeterTaylor Thank you, I have now removed that section from my answer. – Peilonrayz Jul 30 '19 at 18:00