3 ms·
I don't think there is a commonly agreed practice. My opinion (and what I tell my students): Independent of the specific license, I would suggest listing sourc
by raphman 15y ago
I don't think there is a commonly agreed practice.
My opinion (and what I tell my students):
Independent of the specific license, I would suggest listing sources (and uses) of all external code in your LICENSE file, and at the header of each file. This makes it much easier to check for license compliance later on. Most open-source licenses require attribution but do not explicitly specify how this should be done.
Example: "check_for_update() from stackoverflow.com/... (CC BY-SA)"
Depending on the license of the code you are using, you might be required to mention its use in your application's documentation (e.g. BSD, CC BY).
If the code is in the Public Domain or is not sophisticated enough to be protected by copyright (thin ice!), there is no need to mention it in the source code.
If it is just a few lines of code, try to put it into its own function and add a short comment. This also allows you to easily remove problematical code later on.
Generally, if it is just a few lines of code, dealing with the license issues is usually not worth it. For example, you can not legally mix CC BY-SA code from Stack Overflow with GPL code. I would suggest just looking at the SO solution and writing your own implementation of the algorithm (not completely safe but probably the most convenient solution).