0

If you borrow code from some source, it is probably best to cite it (like "adapted from [source]"). However, if you take let's say you borrowed this function (example in C++):

void doWork()
{
     cout << "Doing work!\n" << endl;
}

and now you editted it to be like this:

void doWork()
{
     string name = "";

     cout << "Starting work...\n" << endl;
     cout << "Hello user. What is your name?" << endl;

     cin >> name;
     ...
}

Would you still have to say "adapted from [source]" or something like that? Or are you in the safe zone?

Note: I am specifically wondering how this applies to copyrighted (and open source) code

1 Answer 1

1

If you are taking code from copyrighted or open source code, then you must conform by the licensing terms under which you obtained the code. If you do not have such a licensing agreement, then you are in violation of copyright law regardless of whether you cite the code or not.

In the case of GPL, in order to use the snippet of code, you must also release ALL of your code under the GPL and include the GPL license as part of your distributed product. You do not need to cite which part you borrowed.

Commercial code typically does not require any form of acknowledgement, licensing or citation.

Other open source licenses may vary in requirements, but as far as I know none require you to cite the individual parts of the code.

4
  • I was borrowing and adapting code from tutorials which don't really say much on how they are licensed, so I wasn't sure whether I should say, "adapted from [source]" when I release my source code Commented Jan 31, 2014 at 14:06
  • 3
    @inixsoftware Then you have to look at each tutorial to see (a) whether it was licensed at all (if not, you can't use it) and (b) what license applies. E.g. on the stack exchange network, all content is licensed under CC-BY-SA which means that you must perform attribution (e.g. through a link to the answer where you took the code from) and must share that code under the same license (I'm not sure, but I don't think this excludes usage in proprietary software). However, many tutorials are written with the intent of code being imitated, so just contact the author if in doubt.
    – amon
    Commented Jan 31, 2014 at 14:10
  • Citing normally has nothing to do with copyrights though.. Citing you normally do for a reader and to prevent plagiarism. So when you copy source code -even if the copyright holder doesn't want it- you still have to give the references and citations when you publish the source code. - As readers may want to know where you got it (and they have the right by plagiarism laws).
    – paul23
    Commented Jan 31, 2014 at 14:22
  • Fun fact: Open source code is copyrighted. Copyright is the legal mechanism which enforces open source licenses just like it makes others get permission/pay you to use your closed source code. Fun fact #2: everything anyone creates is implicitly copyrighted to them, including the online tutorials. I second amon's advice: Contact the author.
    – Philip
    Commented Jan 31, 2014 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.