2

I'm building a library and want to release it under MIT.

Among other functions, this library has to emulate the internal behaviour of std::unordered_set from libstdc++ (precisely -- determine the number of buckets by the number of elements). In order to do it I read the source code of libstdc++ and implemented the similar thing in my library. Also, there is a configuration file in libstdc++: a hard-coded list of 256 prime numbers which are potential hashtable sizes. It is not possible to emulate what I need without this list.

The main problem is that libstdc++ sources are released by GPL, which is not compatible with MIT this way.

I have two questions.

1) is it possible to put this hard-coded list into my code? Maybe I should claim that I produced it by interacting with unordered_set like a black box (it is possible) without looking at the source code explicitly.

2) is the part "I didn't copy your sources, I just implemented mine which do the same thing but do not share a line with yours" violating the license?

5
  • Do you have a link to the files on the libstc++ and on your side? Commented Jul 1, 2017 at 10:33
  • @PhilippeOmbredanne libstdc++ version: github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/src/…; my copied version: github.com/ifsmirnov/jngen/blob/master/gcc_primes_list.h Commented Jul 1, 2017 at 10:35
  • It is a very bad idea to depend on internal details, which might change at any moment, with no notice whatsoever.
    – vonbrand
    Commented Feb 20, 2020 at 12:25
  • @vonbrand The purpose of that part of the library is generating examples of data where certain implementations of std::unordered_set behave poorly (insertions degrade to linear time). The algorithm is chosen based on compiler version which the caller explicitly provides. So for this task you have to depend on internal details. Commented Feb 20, 2020 at 12:36
  • @IvanSmirnov, test code for a library under a different license than the original. Weird.
    – vonbrand
    Commented Feb 20, 2020 at 13:29

1 Answer 1

5

1) is it possible to put this hard-coded list into my code? Maybe I should claim that I produced it by interacting with unordered_set like a black box (it is possible) without looking at the source code explicitly.

In your specific context, the list in question is a list of prime numbers. In general I do not think such a short list of numbers would be eligible for copyright protection. Furthermore, based on the comments you posted, your own list is not copied from GCC but generated form a utility of yours.

As a side note, the libgo subsystem in GCC is BSD-licensed and there is a mention that the same primes list has been copied from the GCC i.e. from the same file. This is a potential, weak hint that Google and the Go developers may not consider this list of numbers as eligible for copyright protection (though they still slap their own license and copyright on top of their copy).

2) is the part "I didn't copy your sources, I just implemented mine which do the same thing but do not share a line with yours" violating the license?

Therefore in light of the above comment I think that you are fine in this context. That said if you still have concerns, the right thing to do would be to post a mail on the GCC mailing list to ask for further opinions about this.

3
  • Finally I decided to get the list from a black box to be 100% clean. At the moment I posted the question my source was a copy of GCC source with a link to it in the comments. However, your argument about libgo is fairly convincing. Commented Jul 4, 2017 at 23:17
  • 1
    Google tends to have a clear reading on what is copyrightable or not. Yet that does not mean they are immune to problems: see the Google vs. Oracle mess around Java ;) Commented Jul 5, 2017 at 21:44
  • 1
    A list of prime numbers is a statement of facts. Unless they were somehow selected with some not obvious criteria, this can't be copyrighted.
    – vonbrand
    Commented Feb 20, 2020 at 12: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.