I know GPL can be used as an open-source license for source code etc. But what if the source code released has very few lines and has a lot of probability that it might also have been written already or someone might write an almost identical code without being aware of the original code?

A code like Hello World for example

#include <iostream>

using namespace std;

int main(){
    cout << "Hello World, with a smile :-)" << endl;

And furthermore, what if he releases the code under some other license, say the BSD license?

  • 4
    Very simple: If it is really common, I'll go filch it from some place where it isn't distributed under a licence I don't like.
    – vonbrand
    Jan 6, 2016 at 0:11

2 Answers 2


German law has something named 'Schöpfungshöhe', which Wikipedia refers to as 'Threshold of originality'. If no sufficient level of originality or effort is reached for the works, it cannot be copyrighted. That means, everyone can probably implement a copy-command, even if it will look pretty similar as the underlying mechanic is simple enough. Still, you shouldn't copy such lines directly but implement it yourself. But coming up with the same solution for similar problems is somewhat expected. When to draw the line? That's up for the courts in cases of disagreement.

Note: As I wrote I know this concept for German law, and Wikipedia indicates Anglo-American law also has this concept. But I don't know to which other jurisdictions this concept applies.

  • 1
    I would not be surprised if the code in the question actually meets the threshold of originality and thus is protected by copyright. Jun 24, 2015 at 15:43
  • All, so your saying I can't copyright and then collect royalties on the semi-colon? Jan 23, 2016 at 23:42

Copyright protection only comes into play when an actual copy has been made of a work.

If two people write a "hello world" program independently of each other, then both programs are protected by copyright and can be published with any license that the author wants.
But as both worked independently of each other, neither can claim that the other infringed on his copyright because no copies were made.
It doesn't even matter here if one has published his work before the other even started, to claim a copyright infringement, you have to prove that someone made a copy of your work.

There is one grey area here: If person A has read the code from person B and then creates something very similar, then there might be cases where person B could successfully argue that person A has effectively made a copy.
For such a claim to be successful, most likely the code of person B has to be of enough originality that it would be unlikely that person A had come up with his solution without seeing the work from person B. This would not be the case with a "hello world" type of program.

  • Note that the GNU project aimed at replicating the Unix system, and specifically called for different design goals for the tools (i.e., more flexibility, relax restrictions, focus on performance) exactly to avoid "accidental" similarities that could get them into legal hot water, with little hope of a "we can attest that nobody of the hundreds of developers who worked on cp(1) ever saw the original source code" defence.
    – vonbrand
    Sep 20, 2015 at 18:40
  • "If two people write a "hello world" program independently of each other, then both programs are protected by copyright" - assuming the program is of enough originality that there can be copyright to speak of. For a "hello world" I don't think it's granted it would be the case.
    – eis
    Sep 4, 2017 at 13:08
  • @eis: I would not be surprised if "hello world" does meet the threshold of originality. To my understanding, the bar on that is pretty low. Sep 4, 2017 at 14:26

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.